Is it possible to retrieve information about images on a web site without having to atually download the actual image? I am interested in width/height and kb size.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. You can get the file size using the
Content-Lengthheader but you would need to at least start downloading the image to get the width/height.Once the image starts downloading you could parse the stream and as @BrokenGlass and @Ed Swangren suggest try to find the image width/height that way.
Having said that, it sounds like an awful lot of work given that you can quickly find the image width/height using available libraries if you download the entire image. Unless you’re dealing with massive images or a massive number of images it may just be easier to download the files and check their size that way.