NAME

Data::Validate::Image - Validates an image and returns basic info

SYNOPSIS

use Data::Validate::Image;

my $validator = Data::Validate::Image->new();
my $image_info = $validator->validate( '/path/to/image' );

if ( defined( $image_info ) ){
    #valid image, do things here
} else {
    #invalid image
}

DESCRIPTION

A simple image validator class, which provides a single validate method that upon success returns a hash ref of image properties:

{
  'width'    => 'image width',
  'height'   => 'image height',
  'size'     => 'image filesize (KB)',
  'mime'     => 'image mime type',
  'file_ext' => '*correct* file extenstion',
  'frames'   => 'frame count', # requires convert from ImageMagick
  'animated' => 1 || 0,        # requires convert from ImageMagick
}

For invalid images the validate method returns undef.

IMPORTANT

REQUIRES convert (from ImageMagick) to detect the frames and animated properties.

I used convert over PerlMagick because I found PerlMagick to be very unstable.

METHODS

validate

Returns image properties for valid image or C<undef> for invalid image

AUTHOR

Mark Ellis <markellis@cpan.org>

CONTRIBUTORS

j1n3l0 - Nelo Onyiah - <nelo.onyiah@gmail.com>

SEE ALSO

Image::Info

LICENSE

Copyright 2015 Mark Ellis <markellis@cpan.org>

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.