GD Question

From: Date: Tue, 05 Apr 2005 18:04:25 +0000
Subject: GD Question
Groups: php.db 
Request: Send a blank email to php-db+get-39120@lists.php.net to get a copy of this message
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);

« previous php.db (#39120) next »