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.

Passing a relative path to a arbitrary file to the new-method will return one of the following specific objects based on the mime type:

METHODS

new($relative_path, $config, $cache)

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

$config is a Config::Simple object, containing, amongst other things, the root-path to build the 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)

reads $self-thumbnail_source> and returns a thumbnail in the requested size. If $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 $self-thumbnail>.

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 method is empty and should be overwritten for images and videos to have a real thumbnail.

thumbnail($size)

returns the actual thumbnail. If the resized thumb already exist, return the path to that one. If no, try to create it first by calling $self-thumbnail_sized>

original

returns the original file