I have this code :
<?php
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $timestamp).' GMT');
header('Content-Type: image/jpeg');
include("config.php") ;
$image = $path_default . $_GET['image'];
if (!$max_width)
$max_width= 170;
if (!$max_height)
$max_height=140;
$size = getimagesize($image);
if(!$size) {
$image = ImageCreate(170,140);
$bgc = ImageColorAllocate($image, 255, 255, 255);
$tc = ImageColorAllocate($image, 0, 0, 0);
ImageFilledRectangle($image, 0, 0, 200, 30, $bgc);
ImageString($image, 5, 47, 53, "NENALEZENO", $tc);
$image = imagejpeg($image);
}
$size = @getimagesize($image);
$width= $size[0];
$height= $size[1];
$x_ratio= $max_width / $width;
$y_ratio=$max_height / $height;
if (($width <= $max_width)&&($height <= $max_height)){
$tn_width = $width;
$tn_height = $height;}
else
if (($width * $height) < $max_height){
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;}
else{
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;}
$scr = imagecreatefromjpeg($image);
$dts = imagecreatetruecolor($tn_width,$tn_height);
imagecopyresampled($dts,$scr,0,0,0,0,$tn_width,$tn_height,$width,$height);
imagejpeg($dts,null,-1);
imagedestroy($scr);
imagedestroy($dts);
?>
bad this code return me not valid JPG!!!! If I upload into some server (maby www.webzdarma.cz) it all OK, but if I test in my localhost picture is bat.
At the start this HEXA "0D 0A 0D 0A". Bad this is not valid JPEG and IE, FireFx etc. dont display it!!!! Where is mistakes??? php_gd2.dll mayby???