Hi guys, I am still having problems with parsing an image's size from a URL (not local path).

Sometimes it determines the size, sometimes it doesn't and I can't quite figure out what the problem might be.

Also, the sizer at the bottom adds only images that are TOO BIG or HAVE NO SIZE and I need the opposite, that's sort of a bug, too, that I can't fix.

Can someone help with one or both of these issues?

if ($limit_img_size) { @image_urls = grep { my $this_url = $_; my $image = get($this_url); print "Getting size of image $this_url<br>"; my ($height, $width) = imgsize(\$image) or die "Error $!"; print "IMG $this_url is $height and $width<br>"; $height <= $max_height && $width <= $max_width && $height ne + "" && $width ne "" } @image_urls; } push @found_images, @image_urls; }
Here is some output of my last run. All image URLs do work but I wouldn't suggest users go to them as who knows what they might be.

Getting size of image http://images.imagefap.com/images/full/8/175/175 +3983749.jpg IMG http://images.imagefap.com/images/full/8/175/1753983749.jpg is and Getting size of image http://images.imagefap.com/images/full/6/123/123 +2501810.jpg IMG http://images.imagefap.com/images/full/6/123/1232501810.jpg is and Getting size of image http://images.imagefap.com/images/full/6/750/750 +454169.jpg IMG http://images.imagefap.com/images/full/6/750/750454169.jpg is and Getting size of image http://images.imagefap.com/images/full/7/173/173 +3232860.jpg IMG http://images.imagefap.com/images/full/7/173/1733232860.jpg is 675 + and 900 Getting size of image http://images.imagefap.com/images/full/8/802/802 +952715.jpg IMG http://images.imagefap.com/images/full/8/802/802952715.jpg is 900 +and 675 Getting size of image http://images.imagefap.com/images/full/7/770/770 +728945.jpg IMG http://images.imagefap.com/images/full/7/770/770728945.jpg is 675 +and 900 Getting size of image http://images.imagefap.com/images/full/5/121/121 +2027075.jpg IMG http://images.imagefap.com/images/full/5/121/1212027075.jpg is 675 + and 900 # # this is a printout of @found_images, as you can see # it only stored images that were too large or did not # have sizes # found images follow http://images.imagefap.com/images/full/8/175/1753983749.jpg -http://images.imagefap.com/images/full/6/123/1232501810.jpg -http://images.imagefap.com/images/full/6/750/750454169.jpg -http://images.imagefap.com/images/full/7/173/1733232860.jpg -http://images.imagefap.com/images/full/8/802/802952715.jpg -http://images.imagefap.com/images/full/7/770/770728945.jpg -http://images.imagefap.com/images/full/5/121/1212027075.jpg

In reply to determining image size by a URL by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.