<img src="doimage.php?id=$some_id">

Bastien

From: Craig Hoffman <[EMAIL PROTECTED]>
To: Wendell Frohwein <[EMAIL PROTECTED]>
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] GD Question
Date: Tue, 5 Apr 2005 14:10:50 -0500

Hi Wendell,
If its not too much trouble, I have one more question. How can I get GD to give me the correct image name and pass a variable to another page. So the image corresponds with the correct title in the DB. Does that make sense?


Thanks again.
Craig
On Apr 5, 2005, at 1:41 PM, Wendell Frohwein wrote:

So, your index.php page is the one with the image in it. How are you
calling the image? When I do something similar, In my index.php page I
would of course have the html code:

<img src="doimage.php" height="20" width="100" border="0">

My doimage.php is the actual code to retrieve / create the thumbnail for
you. If you were trying to have the code that creates the thumbnail in
your index.php, this explains why you were getting binary information in
your code.

I hope that helps.


PS You might want to try creating thumbnails when you initially upload your image. This saves on cpu power.
Yes I know. Thanks.

-Wendell

-----Original Message-----
From: Craig Hoffman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 05, 2005 11:04 AM
To: php-db@lists.php.net
Subject: [PHP-DB] GD Question

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


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


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



Reply via email to