acctman Posted May 3, 2009 Share Posted May 3, 2009 i noticed today that all my sites that use the fuction getimagesize() have stop working... I ran a test script and received the error below. Warning: getimagesize(http://www.site.com/files/tfile.jpg) [function.getimagesize]: failed to open stream: Cannot assign requested address in /home/site/public_html/files/test4.php on line 2 width: height: $size = getimagesize("http://www.ratemybottom.com/files/tfile.jpg"); echo "width: $size[0]<br>"; echo "height: $size[1]<br>"; echo "$size[3]"; Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/ Share on other sites More sharing options...
hchsk Posted May 3, 2009 Share Posted May 3, 2009 give us the function. . . . Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824922 Share on other sites More sharing options...
DarkWater Posted May 3, 2009 Share Posted May 3, 2009 give us the function. . . . What? It's in the GD library. Any change in PHP version or ini settings on your site? Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824924 Share on other sites More sharing options...
hchsk Posted May 3, 2009 Share Posted May 3, 2009 oh, haha, i was unaware. well i might suggest in that case simply making your own getimagesize() function, which should be simple enough also, the link is dead, the image does not load, perhaps that is the problem? after all it says "failed to open stream: " Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824925 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 oh, haha, i was unaware. well i might suggest in that case simply making your own getimagesize() function, which should be simple enough also, the link is dead, the image does not load, perhaps that is the problem? after all it says "failed to open stream: " uhhh, i'm not being rude but please stop responding. Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824928 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 give us the function. . . . What? It's in the GD library. Any change in PHP version or ini settings on your site? no recent changes, last change to php.ini was on May 23rd. everything was working fine yesterday Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824929 Share on other sites More sharing options...
hchsk Posted May 3, 2009 Share Posted May 3, 2009 wwow, yeah i realize now how stupid that was, however yes, you are a prick. but my point still stands, make your own function, then you can customize it, and it becomes easier to troubleshoot Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824930 Share on other sites More sharing options...
mattal999 Posted May 3, 2009 Share Posted May 3, 2009 Can we see the code of test4.php please? Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824932 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 Can we see the code of test4.php please? this is all that is inside the test4.php file... i'm trying to figure out why it would just stop working <?php $size = getimagesize("http://www.site.com/files/tfile.jpg"); echo "width: $size[0]<br>"; echo "height: $size[1]<br>"; echo "$size[3]"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824940 Share on other sites More sharing options...
mattal999 Posted May 3, 2009 Share Posted May 3, 2009 Sorry to act like an idiot, but shouldn't http://www.site.com/files/tfile.jpg be http://www.ratemybottom.com/files/tfile.jpg Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824941 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 Sorry to act like an idiot, but shouldn't http://www.site.com/files/tfile.jpg be http://www.ratemybottom.com/files/tfile.jpg I used "site.com" out side of the coded tag so my url wouldn't be picked up in SE searchs, most users on the site do the same thing. The actual url and link in the script on my server is 100% correct. I also have 5 our sites in which the coding hasn't been touched, and the getimagesize has stopped working. the problem is not the coding, it seems like something was auto updated or a bug in GD or something Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824948 Share on other sites More sharing options...
gevans Posted May 3, 2009 Share Posted May 3, 2009 Depending on what version of php you're using you might want to try the following, Otherwise uncomment the second line and see if you are getting an array assigned to the size var. <?php $size = getimagesize("http://www.site.com/files/tfile.jpg"); //var_dump($size); echo "width: {$size[0]}<br>"; echo "height: {$size[1]}<br>"; echo "{$size[3]}"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824949 Share on other sites More sharing options...
kenrbnsn Posted May 3, 2009 Share Posted May 3, 2009 Is the file you're trying to access a local file (i.e. on the same server as your script) or a remote file? Ken Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824955 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 Is the file you're trying to access a local file (i.e. on the same server as your script) or a remote file? Ken yes the test file in local in the same folder as the test file. test4.php and tfile.jpg are in the same folder Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824962 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 Depending on what version of php you're using you might want to try the following, Otherwise uncomment the second line and see if you are getting an array assigned to the size var. <?php $size = getimagesize("http://www.site.com/files/tfile.jpg"); //var_dump($size); echo "width: {$size[0]}<br>"; echo "height: {$size[1]}<br>"; echo "{$size[3]}"; ?> i just tried that, var dump uncommented produces the same error but with bool(false) Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824964 Share on other sites More sharing options...
gevans Posted May 3, 2009 Share Posted May 3, 2009 Is the file you're trying to access a local file (i.e. on the same server as your script) or a remote file? Ken yes the test file in local in the same folder as the test file. test4.php and tfile.jpg are in the same folder If you're doing it locally why don't you do it without the url? <?php $size = getimagesize("tfile.jpg"); var_dump($size); echo "width: {$size[0]}<br>"; echo "height: {$size[1]}<br>"; echo "{$size[3]}"; ?> EDIT And if that doesn't work test it qith a different image to make sure the image itself isn't corrupt Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-824971 Share on other sites More sharing options...
acctman Posted May 3, 2009 Author Share Posted May 3, 2009 Is the file you're trying to access a local file (i.e. on the same server as your script) or a remote file? Ken yes the test file in local in the same folder as the test file. test4.php and tfile.jpg are in the same folder If you're doing it locally why don't you do it without the url? <?php $size = getimagesize("tfile.jpg"); var_dump($size); echo "width: {$size[0]}<br>"; echo "height: {$size[1]}<br>"; echo "{$size[3]}"; ?> EDIT And if that doesn't work test it qith a different image to make sure the image itself isn't corrupt i did some more testing and it works without putting the in http://... just the test file was in the same directory. so what works now is inputing the abosolute server path to the image folders and locations. very odd considering the original examples I got for getimagesize came from php.net which gives the usage of http:// url as an example http://us2.php.net/getimagesize Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-825007 Share on other sites More sharing options...
gevans Posted May 3, 2009 Share Posted May 3, 2009 Maybe something to do with local configurations, who knows. At least it's working now Quote Link to comment https://forums.phpfreaks.com/topic/156666-solved-getimagesize-stopped-working/#findComment-825019 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.