WWW-MeGa

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

requires:
  CGI::Application: 0
  CGI::Application::Plugin::Config::Simple: 0
  CGI::Application::Plugin::HTCompiled: 0
  CGI::Application::Plugin::Stream: 0
  File::Basename: 0
  File::Path: 0
  File::ShareDir: 0
  File::Spec: 0
  Image::ExifTool: 0
  Image::Magick: 0
  MIME::Types: 0
version: 0.09_3

Makefile.PL  view on Meta::CPAN

requires	'Scalar::Util' => 0;
requires	'CGI::Application' => 0;
requires	'CGI::Application::Plugin::HTCompiled' => 0;
requires	'CGI::Application::Plugin::Config::Simple' => 0;
requires	'CGI::Application::Plugin::Stream' => 0;
requires	'File::Spec' => 0;
requires	'File::Basename' => 0;
requires	'File::Path' => 0;
requires	'MIME::Types' => 0;
requires	'Image::ExifTool' => 0;
requires	'Image::Magick' => 0;
requires	'File::ShareDir' => 0;

install_share;

WriteAll;

lib/WWW/MeGa.pm  view on Meta::CPAN

Path where to store the thumbnails

=head3 album-thumb

specifies which file should be used a thumbnail for a folder. Defaults to C<THUMBNAIL>.
The file named like that will be skipped when showing the content of the folder.

=head3 thumb-type

Type of the thumbnails.
L<WWW::MeGa> uses L<Image::Magick> for generating thumbnails.
See C<convert -list format> for file types supported by you ImageMagick
installation.

=head3 video-thumbs

If set to 1, enables video-thumbs. Default: 1

=head3 video-thumbs-offset

specifies which frame to grab in seconds. Default: 10

lib/WWW/MeGa/Item.pm  view on Meta::CPAN

reads C<$self->thumbnail_source> and returns a thumbnail in the
requested size. If C<$self->thumbnail_source> does not exist, it use
a icon based on the mime type.

It should not be called directly but through the caching methode C<$self->thumbnail>.

=cut

sub thumbnail_sized
{
	use Image::Magick;

	my $self = shift;
	my $size = shift;
	my $type = $self->{config}->param('thumb-type');
	my $img = $self->thumbnail_source;

	$img = File::Spec->catdir($self->{config}->param('icons'), $self->{type} .'.'. ICON_TYPE)
		if !$img or not -r $img;

	my @magick =
	(
		[ 'Read', $img ],
		[ 'Resize', $size . 'x' . $size],
		[ 'AutoOrient', 1],
		[ 'ImageToBlob', { magick => $type } ]
	);

        my $image = Image::Magick->new;
	foreach my $cmd (@magick)
	{
		my ($m, $p) = @$cmd;
		my $ret = $image->$m($p);
		return $ret if $m eq $magick[@magick-1]->[0];

		warn $ret and return if $ret;
	}
}



( run in 0.691 second using v1.01-cache-2.11-cpan-beeb90c9504 )