MT::Image - Movable Type image manipulation routines
use MT::Image;
my $img = MT::Image->new( Filename => '/path/to/image.jpg' );
my($blob, $w, $h) = $img->scale( Width => 100 );
open FH, ">thumb.jpg" or die $!;
binmode FH;
print FH $blob;
close FH;
MT::Image contains image manipulation routines using either the NetPBM tools or the ImageMagick and Image::Magick Perl module. The backend framework used (NetPBM or ImageMagick) depends on the value of the ImageDriver setting in the mt.cfg file (or, correspondingly, set on an instance of the MT::ConfigMgr class).
Currently all this is used for is to create thumbnails from uploaded images.
new(%arg)Constructs a new MT::Image object. Returns the new object on success; on
error, returns undef, and the error message is in MT::Image->errstr.
%arg can contain:
scale(%arg)Creates a thumbnail from the image represented by $img; on success, returns
a list containing the binary contents of the thumbnail image, the width of the
scaled image, and the height of the scaled image. On error, returns undef,
and the error message is in $img->errstr.
%arg can contain:
100% of the original (that is,
the same size). If you provide both, the image will likely look rather
distorted.
100 to return the original image without resizing) by which both the
width and height will be scaled equally.
Please see the MT manpage for author, copyright, and license information.