Forum Moderators: coopster
<?php
Header("Content-type: image/jpeg");
$filenamee = "$_SERVER[DOCUMENT_ROOT]/$filename";
$orig_image = imagecreatefromjpeg($filenamee);
list($width, $height, $type, $attr) = getimagesize($filenamee);
if ($width > $size) {
$ratio = $size / $width;
$newwidth = $size;
$newheight = $ratio * $height; }
if ($width <= $size) {
$newwidth = $width;
$newheight = $height; }
$sm_image = imagecreatetruecolor($newwidth,$newheight) or die ("Cannot Initialize new GD image stream");;
Imagecopyresampled($sm_image,$orig_image,0,0,0,0,$newwidth,$newheight,imagesx($orig_image),imagesy($orig_image));
imageJPEG($sm_image);
imagedestroy($sm_image);
imageDestroy($orig_image);
?>
http://www.example.com/myscript.php?name=value&size=100
Your $size field looks to be undefined in your script and therefore failing. You need to define it by assigning it the appropriate value.
I use this URL before and the program has successfully re-sized the image.
http://example.com/resize.php?size=115&filename=#*$!.jpg
Thanks again.
[edited by: dreamcatcher at 6:04 pm (utc) on June 1, 2009]
[edit reason] use example.com. Thanks. [/edit]