My apologies for being a complete pest with this issue. I changed a few things around and I can now pass the image name thanks to Jos, however, I'm getting a permission errors now.
Warning: imagejpeg(): Unable to open 'corneilus.jpg' for writing
I've changed image folder and subfolder permissions to 777 and no luck. Any ideas.
Again thanks your help. :)
Craig
On Apr 6, 2005, at 11:18 AM, Juffermans, Jos wrote:
Hi,
Are you trying to display more images at once then?
You can store the image like you do now, then have the GD script output the
image tag and use the image you've just stored as a source.
GD script: ... ImageJPEG($thumb, $route_photo, '100'); echo '<img src="$route_photo" width="125" height="225" border="0" title="$route_photo" alt="$route_photo" />'; // add this line ImageDestroy($thumb); ...
in the other script instead of echo ("<img src='include/function_gd.php?route_photo=$thumb' align='center' id='image'>"); do this: require("include/function_gd.php?route_photo=$thumb");
Jos
-----Original Message----- From: Craig Hoffman [mailto:choffman@xxxxxxxxxx] Sent: 06 April 2005 18:12 To: php-db@xxxxxxxxxxxxx Cc: Juffermans, Jos Subject: Re: One more GD ? -- filename
Hi Jos, I understand what your saying. The problem is all the image names are listed in the DB (image.jpg, image1.jpg and so on) and all images have titles attached. For example, Title: Large Green Sea Turtle Image: LargeGreenSeaTurtle.jpg
As you can see, the GD script randomly pulls photo names from the DB and shows them. When I output the image with using the image tag I get a blank variable.
<img src='include/function_gd.php?route_photo=' '' height='x' width='x' align='center' id='image'>
Since the image name is empty, I can not match/query the title and image. The image output may be showing a Blue Sea Turtle but the title says, Green Sea Turtle. If I could just get the image name, I could run a query to match them. Does this make sense?
On Apr 6, 2005, at 10:36 AM, Juffermans, Jos wrote:
Hi,
If I understand correctly, you're using "include/function_gd.php?route_photo=$thumb" as image source which is the script you pasted. If you use a script as image source, the script should output the image data - not just store the image.
I'm not sure what you're trying to do but if you have an image object in php (eg $thumb), you should output that image:
<?php $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); header("Content-type: image/jpeg"); // tell the browser to expect a JPG imagejpeg($thumb, "", 100); // send the image to the browser (filename="" => output instead of save) exit(); ?>
However, you cannot use that to show multiple images from 1 script.
Jos
-----Original Message----- From: Craig Hoffman [mailto:choffman@xxxxxxxxxx] Sent: 06 April 2005 15:24 To: php-db@xxxxxxxxxxxxx Subject: One more GD ? -- filename
Thanks everyone for answering my other post. However, I'm still having
trouble passing the image name from the GD script to the image tag.
I'm including the GD script below. Any help would be great. Thanks -
Craig
//GD script <?php include ("db.php"); $query = "SELECT route_photo FROM routes WHERE route_photo IS NOT NULL ORDER BY RAND() LIMIT 1"; $result = mysql_query($query, $db) or die(mysql_error());
while($row = mysql_fetch_array($result)) { //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, $route_photo, '100'); ImageDestroy($thumb); } ?>
//Image Tag: echo ("<img src='include/function_gd.php?route_photo=$thumb' align='center' id='image'>");
-- 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
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php