RE: [PHP] get image size function
| From: | Tyler Durdin | Date: | Thu, 10 Apr 2003 00:09:31 +0000 |
| Subject: | RE: [PHP] get image size function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143240@lists.php.net to get a copy of this message | ||
That took care of it. Thanks a million for all of the help.
From: "Jack Dempsey" <dempsejn@georgetown.edu> To: "Tyler Durdin" <linuxgeek23@hotmail.com>, <php-general@lists.php.net> Subject: RE: [PHP] get image size function Date: Wed, 9 Apr 2003 18:20:43 -0400 when you call getimagesize on the numbnail you do $thumbnail = $thumbnail_dir . trim($photos[$i]); however when you try to get the size of the photos you don't give it a directory, just the name. So, set a $picture_dir to wherever the pictures are, then $image = $picture_dir . trim($photos[$i]); $image_size = getimagesize($image); the same logic you used for the thumbnails jack -----Original Message----- From: Tyler Durdin [mailto:linuxgeek23@hotmail.com] Sent: Wednesday, April 09, 2003 5:43 PM To: php-general@lists.php.net Subject: RE: [PHP] get image size function So let me get this straight. I defined the thumbnail directory in thumbnail_dir, but I never defined a directory for the photos? So that would mean that since it cannot find the photos the array would be empty and just display array, as it does for the $photos value. So, can you recommend to me where/how I should define the path the pictures? Here's where I define the photos value: $photos = file($data_file); the data file value is: $data_file = "pictures/pictures/list.photos"; The $data_file lists the path, but for some reason the value of $photos is coming up as array (which i assume it's not finding it. Should I try pointing it to the directory instead of to the text file?_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virusok, looking at that, i'd say a few things: first, its easier if you have .phps enabled, so the source is nice and colorized :-) also, on the lines that seem to work, you do: $thumbnail = $thumbnail_dir.trim($photos[$i]); $thumb_image_size = getimagesize($thumbnail); $image_size = getimagesize(trim($photos[$i])); having set $thumbnail_dir previously. but then you try to get the image of the photo without givingthe completedirectory for it...try that and let me know... jackIt's-----Original Message----- From: Tyler Durdin [mailto:linuxgeek23@hotmail.com] Sent: Wednesday, April 09, 2003 4:37 PM To: php-general@lists.php.net Subject: RE: [PHP] get image size function Here is the link to the site. http://shaggy.ohioprincipals.org/comgo_test/gallery.php Here is a link that shows the all of the code http://shaggy.ohioprincipals.org/comgo_test/gallery.html I have put as many of the variable values at the bottom of the php page so you can see what I am talking about. Thanks for all of the help.until I get togreatly appreciated.<php-general@lists.php.net>From: "Jack Dempsey" <dempsejn@georgetown.edu> To: "Tyler Durdin" <linuxgeek23@hotmail.com>,Subject: RE: [PHP] get image size function Date: Wed, 9 Apr 2003 16:21:23 -0400 hey tyler,When I echo/print the variables everything goes wellone:$photos = file($data_file); That's when I get a value of array. Anybody got any idea why this is doing this?well, that's different than the line you listed before. $photos is obviously going to be an array because file() returnsiarray file ( string filename [, int use_include_path]) as far as your errors before, if you would give the output of whatyour photosuggested, maybe we could figure things out...the url to the site to see ifthe actualimages are where php's looking could help too... jackFrom: John Dempsey <dempsejn@gusun.georgetown.edu> To: Tyler Durdin <linuxgeek23@hotmail.com> CC: php-general@lists.php.net Subject: Re: [PHP] get image size function Date: Wed, 9 Apr 2003 15:38:47 -0400 (EDT) ok, so that looks like its not finding the file given ingetting the fullarray...not to doubt you, but are you sure you'recheckactuallyfilename, extension included, in the array, and that the file'sin the same directory? try a test with file_exists to make sureits there,and print out what the trim($photos[$i]) value is to doublewith print_rwhat's[function.getimagesize]: failedhappening... jack On Wed, 9 Apr 2003, Tyler Durdin wrote:were there. SoI ran the print_r and sure enough all of the image valuesnowI am stuck again. This is the error message I am getting: Warning: getimagesize(Mvc-038f.jpg)tocreate stream: No such file or directory in /www/servers/comgo_test/gallery.php on line 47 And this is line 47 $image_size = getimagesize(trim($photos[$i])); These are the variables the line is referring to $photos = file($data_file); ** the datafile just has the names of 3 jpg images **From: dempsejn@georgetown.edu To: "Tyler Durdin" <linuxgeek23@hotmail.com> CC: php-general@lists.php.net Subject: Re: [PHP] get image size function Date: Wed, 09 Apr 2003 14:17:06 -0400 hey tyler, just looking at that quickly, i'd try testing ittoitsseethe structure; if you're getting the string "Array" then{$size[3]}>";print_r($var)obviouslyan array that you have to then select something from.should make it clear. jack ----- Original Message ----- From: "Tyler Durdin" <linuxgeek23@hotmail.com> Date: Wednesday, April 9, 2003 2:13 pm Subject: [PHP] get image size functionWhen I run this script: <?php $size = getimagesize ("pictures/pictures/bobby.jpg"); echo "<img src=\"pictures/pictures/bobby.jpg\"http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963image. Why am?> I get Array (the word Array) and a picture of theIuse the imagenot getting the image size? Did I not configure php toit's notfunctions? If that's the case how can I correct this problem? Ifthe_________________________________________________________________case what is going on here? Please help!!!Protect your PC - get McAfee.com VirusScan Online__________________________________________________________________________________________________________________________________-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpMSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpTired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php