The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::MeGa::Item - Representing a item in WWW::MeGa

SYNOPSIS

 use WWW::MeGa::Item;
 my $item = WWW::MeGa::Item->new('some/file.jpg', $config, $cache);
 print $item->thumbnail(1);

DESCRIPTION

WWW::MeGa::Item represents a "item" in WWW::MeGa. It get instanced by passed a relative path to a arbitrary file and return on of the following specific object based on the mime type:

METHODS

new($relative_path, $config, $cache)

creates a new WWW::MeGa::Item::* object based on mime type of the file specified by $relative_path.

$config is a Config::Simple object, containing amongst other things the root-path to build a absolute path.

$cache is a hash reference to cache the exif data

data

returns necessary data for rendering the template

exif

read, return and cache the exif data for the represented file

thumbnail_sized($size, $type)

makes sure that a thumbnail exists (calls $self-thumbnail> in case its not) in requested size and returns a path to it. Should not be called directly but through the caching methode

thumbnail_source

returns the source for the thumbnail. Thats the original file that can be scaled via thumbnail_sized. Think of it as a image represenation for the file type. This methode selects a icon based on the mime type. But this methode gets overwritten for images and videos to have a real thumbnail.

thumbnail($size)

returns the actual thumbnail

original

returns the original file