Php's Getimagesize()

I'm wondering if I run this:<br />$hash = getimagesize("http://www.someotherserver_notmine.com/image.jpg");<br /><br />does it count against my bandwidth? does the getimagesize command require the executing server to actually fetch the image from the hosting server? or does it simply fetch header information for that image? <br /><br />I use this a lot in my code, so it would be a great help to get some insights. Thanks guys!<!--content-->
<!--QuoteBegin-mangarevolution+May 3 2005, 07:10 PM--><div class='quotetop'>QUOTE(mangarevolution @ May 3 2005, 07:10 PM)</div><div class='quotemain'><!--QuoteEBegin-->I'm wondering if I run this:<br />$hash = getimagesize("http://www.someotherserver_notmine.com/image.jpg");<br /><br />does the getimagesize command require the executing server to actually fetch the image from the hosting server? or does it simply fetch header information for that image? <br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=127988"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />The getimagesize() PHP function retrieves the entire image when called on an image URL.<br /><br /><!--QuoteBegin-mangarevolution+May 3 2005, 07:10 PM--><div class='quotetop'>QUOTE(mangarevolution @ May 3 2005, 07:10 PM)</div><div class='quotemain'><!--QuoteEBegin-->does it count against my bandwidth? <br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=127988"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Yes, it does. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
<!--QuoteBegin-TCH-David+May 4 2005, 01:02 AM--><div class='quotetop'>QUOTE(TCH-David @ May 4 2005, 01:02 AM)</div><div class='quotemain'><!--QuoteEBegin--><!--QuoteBegin-mangarevolution+May 3 2005, 07:10 PM--><div class='quotetop'>QUOTE(mangarevolution @ May 3 2005, 07:10 PM)</div><div class='quotemain'><!--QuoteEBegin-->I'm wondering if I run this:<br />$hash = getimagesize("http://www.someotherserver_notmine.com/image.jpg");<br /><br />does the getimagesize command require the executing server to actually fetch the image from the hosting server? or does it simply fetch header information for that image? <br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=127988"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />The getimagesize() PHP function retrieves the entire image when called on an image URL.<br /><br /><!--QuoteBegin-mangarevolution+May 3 2005, 07:10 PM--><div class='quotetop'>QUOTE(mangarevolution @ May 3 2005, 07:10 PM)</div><div class='quotemain'><!--QuoteEBegin-->does it count against my bandwidth? <br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=127988"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Yes, it does. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=128009"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><br /><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br /><br />I was afraid of that. thanks for the insights, I couldn't find that answer anywhere.<!--content-->
No problem - I coudn't find an answer that was recent enough to be relied on, but it mentioned a method to prove what getimagesize() does easily: Write a simple script that uses getimagesize() on a large image. After running the script, the full image retrieval by getimagesize() will be shown in the Apache access log.<!--content-->
I think you can call getimagesize() with a simple filesystem path and it will simply get the image directly from the filesystem instead of generating an HTTP request for it and spending some bandwidth <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
<!--QuoteBegin-TCH-Raul+May 5 2005, 08:08 AM--><div class='quotetop'>QUOTE(TCH-Raul @ May 5 2005, 08:08 AM)</div><div class='quotemain'><!--QuoteEBegin-->I think you can call getimagesize() with a simple filesystem path and it will simply get the image directly from the filesystem instead of generating an HTTP request for it and spending some bandwidth <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=128304"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />That's correct, but the image does have to be stored on the local server in order to do so. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->$hash = getimagesize("http://www.<b>someotherserver_notmine</b>.com/image.jpg");<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />You're right, David. Sorry, I should have read mangarevolution's post more carefully. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blush.gif" style="vertical-align:middle" emoid=":blush:" border="0" alt="blush.gif" /><!--content-->
 
Back
Top