Image::TestJPG - Test the validity of JPEG image streams.


Image-TestJPG documentation  | view source Contained in the Image-TestJPG distribution.

Index


NAME

Top

Image::TestJPG - Test the validity of JPEG image streams.

SYNOPSIS

Top

 use Image::TestJPG;

  # read data from a file
 open(JPEG, "<$file") or die "Can't open $file : $!\n";
 binmode JPEG;
 my $jpgData = do { local $/; <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 ...
 }




DESCRIPTION

Top

 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.

EXPORT

Top

 None by default.

AUTHOR

Top

 Jason Hudgins <jasonlee@spy.net>

COPYRIGHT

Top


Image-TestJPG documentation  | view source Contained in the Image-TestJPG distribution.