Re: [PHP-DB] One more GD ? -- filename
Hi There (again), 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 ''; // add this line ImageDestroy($thumb); ... in the other script instead of echo (""); do this: require("include/function_gd.php?route_photo=$thumb"); Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 18:12 To: php-db@lists.php.net Cc: Juffermans, Jos Subject: Re: [PHP-DB] 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. 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: output instead of save) exit(); ?> However, you cannot use that to show multiple images from 1 script. Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 15:24 To: php-db@lists.php.net Subject: [PHP-DB] 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 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 (""); -- 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
RE: [PHP-DB] One more GD ? -- filename
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 '';// add this line ImageDestroy($thumb); ... in the other script instead of echo (""); do this: require("include/function_gd.php?route_photo=$thumb"); Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 18:12 To: php-db@lists.php.net Cc: Juffermans, Jos Subject: Re: [PHP-DB] 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. 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: > >$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:[EMAIL PROTECTED] > Sent: 06 April 2005 15:24 > To: php-db@lists.php.net > Subject: [PHP-DB] 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 >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 (" 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
Re: [PHP-DB] 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. 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: output instead of save) exit(); ?> However, you cannot use that to show multiple images from 1 script. Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 15:24 To: php-db@lists.php.net Subject: [PHP-DB] 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 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 (""); -- 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
RE: [PHP-DB] One more GD ? -- filename
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: output instead of save) exit(); ?> However, you cannot use that to show multiple images from 1 script. Jos -Original Message- From: Craig Hoffman [mailto:[EMAIL PROTECTED] Sent: 06 April 2005 15:24 To: php-db@lists.php.net Subject: [PHP-DB] 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 //Image Tag: echo (""); -- 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
Re: [PHP-DB] One more GD ? -- filename
I believe the problem is somewhere in the GD script. Because when I view the source it shows an empty variable. I should at least see the name of variable in the source. Any ideas? On Apr 6, 2005, at 9:46 AM, Bastien Koert wrote: Have a look here...I have some sample code on calling images from a db. It used the two pages like you do here and passes the ID back and forth to the image production page...maybe it will help http://www.weberdev.com/get_example-4062.html bastien From: Craig Hoffman <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] One more GD ? -- filename Date: Wed, 6 Apr 2005 08:23:40 -0500 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 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 (""); -- 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
RE: [PHP-DB] One more GD ? -- filename
Have a look here...I have some sample code on calling images from a db. It used the two pages like you do here and passes the ID back and forth to the image production page...maybe it will help http://www.weberdev.com/get_example-4062.html bastien From: Craig Hoffman <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] One more GD ? -- filename Date: Wed, 6 Apr 2005 08:23:40 -0500 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 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 (""); -- 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-DB] 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 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 (""); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php