Image::TestJPG - Test the validity of JPEG image streams.
use Image::TestJPG; # read data from a file open(JPEG, "<$file") or die "Can't open $file : $!\n"; my $jpgData = <JPEG>; close(JPEG); # test the data $rv = Image::TestJPG::testJPG($jpgData, length($jpgData)); # do something based on the return value if($rv) { ... jpeg data is valid ... } else { ... jpeg data contains errors ... }
This module provides a single function, testJPG, that will quickly decompress a JPEG stream. If any errors are detected during the decompression process the function returns 0, otherwise it returns 1. Image::TestJPG::testJPG(<DATA>, <LENGTH OF DATA>); Typical uses of this module would include testing the validity of an uploaded jpg image, before storage.
None by default.
Jason Hudgins <jason@netfist.com>
Copyright (c) 2003 Jason Hudgins. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Image::TestJPG, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::TestJPG
CPAN shell
perl -MCPAN -e shell install Image::TestJPG
For more information on module installation, please visit the detailed CPAN module installation guide.