GD Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Everyone,
I wrote a GD function that resizes some images and displays them as thumbnails. When I put the function in the index.php page I receive an error Warning: Headers have already been sent... then it shows a bunch of binary. I do not want re-save the file, I just want resize and show it. What am I doing wrong here? Any help would be great.
- Craig


//query the DB for image name
Some query...
//Photo varibale
$route_photo = $row["route_photo"];

//Start GD
//New Image resize
$new_width = 125;
$new_height = 225;

//Content Type
header("Content-type: image/jpeg");

//Start new image resize
list($width_orig, $height_orig) = getImageSize("./images/climbs/$route_photo");

if ($new_width && ($width_orig < $height_orig)) {
$new_width = ($new_height / $height_orig) * $width_orig;
} else {
$new_height = ($new_width / $width_orig) * $height_orig;
}

//resample the image
$thumb = ImageCreateTrueColor($new_width, $new_height);
$tmp_image = ImageCreateFromJPEG("./images/climbs/$route_photo");
ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);

ImageJPEG($thumb,'','100');
ImageDestroy($thumb);


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux