Muster
view release on metacpan or search on metacpan
"File::Find" => 0,
"File::LibMagic" => 0,
"File::MimeInfo::Magic" => 0,
"File::ShareDir" => 0,
"File::Slurper" => 0,
"File::Spec" => 0,
"File::stat" => 0,
"HTML::LinkList" => 0,
"Hash::Merge" => 0,
"Image::ExifTool" => 0,
"Image::Magick" => 0,
"Lingua::EN::Inflexion" => 0,
"Lingua::EN::Titlecase" => 0,
"Math::Calc::Parser" => 0,
"Module::Pluggable" => 0,
"Mojo::Base" => 0,
"Mojo::URL" => 0,
"Mojo::Util" => 0,
"Mojolicious::Commands" => 0,
"POSIX" => 0,
"Path::Tiny" => 0,
File::Find: '0'
File::LibMagic: '0'
File::MimeInfo::Magic: '0'
File::ShareDir: '0'
File::Slurper: '0'
File::Spec: '0'
File::stat: '0'
HTML::LinkList: '0'
Hash::Merge: '0'
Image::ExifTool: '0'
Image::Magick: '0'
Lingua::EN::Inflexion: '0'
Lingua::EN::Titlecase: '0'
Math::Calc::Parser: '0'
Module::Pluggable: '0'
Mojo::Base: '0'
Mojo::URL: '0'
Mojo::Util: '0'
Mojolicious::Commands: '0'
POSIX: '0'
Path::Tiny: '0'
lib/Muster/Hook/Img.pm view on Meta::CPAN
=cut
use Mojo::Base 'Muster::Hook::Directives';
use Muster::LeafFile;
use Muster::Hooks;
use Muster::Hook::Links;
use File::Basename qw(basename);
use File::Spec;
use File::Slurper 'write_binary';
use Image::Magick;
use YAML::Any;
use Carp 'croak';
=head1 METHODS
L<Muster::Hook::Img> inherits all methods from L<Muster::Hook::Directives>.
=head2 register
lib/Muster/Hook/Img.pm view on Meta::CPAN
# Aspect ratio will be preserved automatically when
# only a width or only a height is specified.
# When both are specified, aspect ratio will not be
# preserved.
$imglink = $img_info->{pagesrcname};
$dwidth = $w if length $w;
$dheight = $h if length $h;
}
else
{
my $im = Image::Magick->new();
my $r = $im->Read(filename=>$img_info->{filename});
croak sprintf(("C. failed to read %s: %s"), $imgpage, $r) if $r;
if (! defined $im->Get("width") || ! defined $im->Get("height"))
{
croak sprintf('failed to get dimensions of %s', $imgpage);
}
if (! length $w && ! length $h)
{
lib/Muster/Hook/Img.pm view on Meta::CPAN
}
# thumbnail?
if ($dwidth < $im->Get("width"))
{
# resize down, or resize to pixels at all
my $outfile = File::Spec->catfile($self->{img_dir}, $params{size} . '-' . $thumb_base);
$imglink = $self->{img_url} . $params{size} . '-' . $thumb_base;
if (-e $outfile && (-M $img_info->{filename} >= -M $outfile))
{
$im = Image::Magick->new;
$r = $im->Read($outfile);
croak sprintf("D. failed to read %s: %s", $outfile, $r) if $r;
}
else
{
$r = $im->Resize(geometry => "${dwidth}x${dheight}");
croak sprintf("failed to resize: %s", $r) if $r;
my @blob = $im->ImageToBlob();
write_binary($outfile, $blob[0]);
t/00-report-prereqs.dd view on Meta::CPAN
'File::Find' => '0',
'File::LibMagic' => '0',
'File::MimeInfo::Magic' => '0',
'File::ShareDir' => '0',
'File::Slurper' => '0',
'File::Spec' => '0',
'File::stat' => '0',
'HTML::LinkList' => '0',
'Hash::Merge' => '0',
'Image::ExifTool' => '0',
'Image::Magick' => '0',
'Lingua::EN::Inflexion' => '0',
'Lingua::EN::Titlecase' => '0',
'Math::Calc::Parser' => '0',
'Module::Pluggable' => '0',
'Mojo::Base' => '0',
'Mojo::URL' => '0',
'Mojo::Util' => '0',
'Mojolicious::Commands' => '0',
'POSIX' => '0',
'Path::Tiny' => '0',
( run in 1.267 second using v1.01-cache-2.11-cpan-beeb90c9504 )