The script works fine when I test it on a stand alone page. I'm just not sure how to include with the "rest" of the site.

On Apr 5, 2005, at 1:17 PM, Philip Hallstrom wrote:

Probably nothing really. When it complains about headers already being sent is the line number the same as your header() line below? If so, that means you're outputting something back to the browser prior to that line.

I'd make sure you don't have any white space before your initial opening <?php tag and I'd also look at "Some query" to see if it's spitting out an error or some sort...


On Tue, 5 Apr 2005, Craig Hoffman wrote:

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);

PHP Database Mailing List (
To unsubscribe, visit:

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to