Plack-Middleware-Image-Scale
view release on metacpan or search on metacpan
* Cleanup whitespaces and various warnings
* Update build system, rename README -> README.md, fix synopsis
0.010 2012-11-07 12:26:00 Europe/Helsinki
* Also match jpeg file extension.
0.009 2012-08-29 14:03:12 Europe/Helsinki
* Experimental and optional PDF support, requires
Image::Magick::Thumbnail::PDF.
0.008 2011-08-24 13:46:16 Europe/Helsinki
* Implement new flag "fit", additional documentation in doc directory.
* Do not try to process empty bodies.
0.007 2011-04-11 21:09:42 Europe/Helsinki
* Changes to matching logic. See README for overview.
* Cleanup documentation.
lib/Plack/Middleware/Image/Scale.pm view on Meta::CPAN
my $oheight = $height;
if ( defined $flag{z} and $flag{z} > 0 ) {
$width *= 1 + $flag{z} / 100 if $width;
$height *= 1 + $flag{z} / 100 if $height;
}
my $output;
if (defined $orig_ct and $orig_ct eq 'application/pdf') {
try {
Class::Load::load_class('Image::Magick::Thumbnail::PDF');
Class::Load::load_class('File::Temp');
my $in = File::Temp->new( SUFFIX => '.pdf' );
my $out = File::Temp->new( SUFFIX => '.png' );
$in->write( $$bufref ); $in->close;
Image::Magick::Thumbnail::PDF::create_thumbnail(
$in->filename, $out->filename, $flag{p}||1, {
frame => 0, normalize => 0,
restriction => max($width, $height),
}
);
my $pdfdata;
$out->seek( 0, 0 );
$out->read( $pdfdata, 9999999 );
$bufref = \$pdfdata;
} catch {
( run in 0.494 second using v1.01-cache-2.11-cpan-beeb90c9504 )