Hi all,
I'm sorry to bombard the board with problems today but i'm having real difficulty understanding why my resize_image script won't work now its in a Unix environment when it worked fine in a Windows environment.
I will post my script (its not very big) not because i can't be bothered to debug and find it for myself but because i don;t think i even know what i'm looking for.
<?php
$image = $HTTP_GET_VARS['image'];
if (!$max_width)
$max_width = 130;
if (!$max_height)
$max_height = 110;
$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 (($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($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
Header('Content: jpeg/image');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);
?>
basically just accepts an image passed from the querystring (incidentally i can;t get this working either, i have been substituting it with an image in the folder).
The problem is it just prints out a load of random stuff, for example
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀnp"ÿÄ ÿĵ}!1AQa"q2?‘¡#B±ÁRÑð$3br‚
No idea whats going on! Please help if you can!
I'm running Apache 1.3 with PHP 5 on Mac OS X 10.3.4
thanks
Stuart