Size of image on a webpage

Started by hdsouza, November 24, 2014, 11:36:44 AM

Previous topic - Next topic

hdsouza

If there an easy way to get the size of the image on a webpage WITHOUT downloading the image first

td

Shot in the dark but maybe check the 'Content-Length' part of a response to a HTTP HEAD request?

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

If you can get the image URL then maybe something like the following

Code (winbatch) Select

WinHttpReq = ObjectCreate("WinHttp.WinHttpRequest.5.1")
WinHttpReq.Open("HEAD","http://forum.winbatch.com/Themes/Winbatch/current_forum.png", @FALSE)
WinHttpReq.Send()
WinHttpReq.WaitForResponse()
strHeader = WinHttpReq.GetResponseHeader("Content-Length")
Message("Image Size", strHeader:' bytes')
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

hdsouza