I'musing win 2k adv server with ie6 - although my full size images look fine and dandy, the php generated thumbnails are all funny colours (see link). It used to be fine with my win xp pro installation - anyone any ideas as to what could be wrong?
<?
// if (!$max_width)
$max_width = 100;
// if (!$max_height)
$max_height = 100;
$file = $directory."/".$file;
$size = GetImageSize($file);
$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 (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($file);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header("Content-type: image/jpeg");
ImageJpeg ($dst, '', 100);
ImageDestroy($src);
ImageDestroy($dst);
?>