ID: 21676 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: No Feedback Bug Type: GetImageSize related Operating System: RAQ4-Latest Patches/Apache 1.3.2 PHP Version: 4.3.0 New Comment:
Yesterday I wrote a script that scans a remote server for image files and then uses getimagesize to determine if its jpeg or png in order to create thumbnails. When I wrote it, I was using 4.23 . Everything worked beautifully. Every image reported correctly and created a thumbnail. Then I used getimagesize again to create width and height attributes in html img tags to make the full size pictures fit on screen. Still everything was working like a 12 year old in a Nike factory... Then I commented to my SysAdmin that I would love to have mb functions enabled for japanese support and how 4.3 has this enabled by default, so he installed 4.3 . Now getimagesize is f$%ked up. Some images still report remotely just fine, but the vast majority do not. I decided to see if this was a connectivity issue by using fopen()...I figured if the pointer returned, then the script can find the image. I get consistent connections with fopen, so I KNOW this is a problem with getimagesize() . I know modifications were made to getimagesize as of 4.3 regarding Mime Types, etc. I think when those modifications were made, old code broke. To test for yourself, set up something like this: $path = "http://youdomain/dir/"; $arrImg = array("xxx.jpg", "xxx2.jpg" ... "xxx20.jpg"); # Test with a lot of different jpgs ~20+ for($i = 0, $m = count($arrImg); $i<$m; $i++) { $size = getimagesize($path . $arrImg[$i]); if ( is_array($size) ) { echo "$arrImg[$i]: $size[0] x $size[1] \n\n"; } else { echo "$arrImg[$i]: getimagesize failed \n"; if ( !$fp = fopen($path . $arrImg[$i], "r") ) { echo "fopen also failed \n"; } else { fclose($fp); echo "fopen found the file\n\n"; } } } die; Previous Comments: ------------------------------------------------------------------------ [2003-02-13 09:07:44] [EMAIL PROTECTED] I can only confirm the former posts: PHP 4.3.0, Apache 1.3.27 on Linux gets confused on some pictures - getimagesize doesn't return correct width / height (it returns FALSE, in fact). Some 60% of all my images are not processed correctly (all of them worked with PHP 4.2.3). An example of such an image is: http://img.radio.cz/pictures/doprava/autobazar1x.jpg If I call getimagesize("http://img.radio.cz/pictures/doprava/autobazar1x.jpg") it returns FALSE, however in case of getimagesize("/the_real_path/pictures/doprava/autobazar1x.jpg") all works fine. Sorry, I can't test the CVS version right now. ------------------------------------------------------------------------ [2003-01-31 13:52:04] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2003-01-16 13:47:43] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip I cannot replicate the described bug using latest snapshot. If you still experience the problem try using the bundled GD library. ------------------------------------------------------------------------ [2003-01-16 13:34:50] [EMAIL PROTECTED] This image returns null information on GetImageSize: http://www.blackpeeps.com/IV/ecnirp/img3d6ea40af403a.jpg This image does return correct Width and Height info: http://www.blackpeeps.com/IV/ecnirp/img3e124d90c8123.jpg I have even tried downloading the first and uploading back to server to make sure there is not a Binary file transfer issue. No luck. Here is a file that my Thumbnail script is not creating a thumbnail for. Well, actually, it creates a Blacked out thumbnail. The script uses ( GetImgageSize , imagecreatetruecolor, and ImageCreateFromJPEG ) http://www.blackpeeps.com/IV/ecnirp/img3cae54c4a3771.jpg ------------------------------------------------------------------------ [2003-01-16 13:32:53] [EMAIL PROTECTED] This image returns null information on GetImageSize: http://www.blackpeeps.com/IV/ecnirp/img3d6ea40af403a.jpg This image does return correct Width and Height info: http://www.blackpeeps.com/IV/ecnirp/img3e124d90c8123.jpg"; I have even tried downloading the first and uploading back to server to make sure there is not a Binary file transfer issue. No luck. Here is a file that my Thumbnail script is not creating a thumbnail for. Well, actually, it creates a Blacked out thumbnail. The script uses ( GetImgageSize , imagecreatetruecolor, and ImageCreateFromJPEG ) http://www.blackpeeps.com/IV/ecnirp/img3cae54c4a3771.jpg ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21676 -- Edit this bug report at http://bugs.php.net/?id=21676&edit=1