- check uploaded image physical pixel size
This can be done relatively easily by parsing the JFIF tags

Nobody's yet mentioned the Image::Size module?

http://search.cpan.org/~rjray/Image-Size-2.992/Size.pm

That's what I'd use before I went poking about in the bytes of a JPEG.

And, the advice to resize images in the code is causing web developers everywhere to weep and wail and gnash their teeth. Please don't do that!

The problem of reading file size has been solved previously. The problem of reading pixel size should be fixed with the above module.

The whole problem -- how to stop users uploading pictures which are too large in file size and/or too large in pixel size -- should be fixed by refusing to post inappropriate files.

unless ( $pixel_size <= $pixel_size_limit
   && $file_size <= $file_size_limit )
{
   refuse_picture();
}

Reply via email to