Why not adopt me?
NAME
Rudesind::Image - An object representing a single image
SYNOPSIS
use Rudesind::Gallery;
my $img = Rudesind::Gallery->image('IMG_0101.JPG');
print $img->file;
DESCRIPTION
This class represents a single image. It provides methods for accessing information on that image, as well as creating transformed versions of the image (resizing, rotating, etc.).
CONSTRUCTOR
Image objects should be constructed by calling the image()
method on a Rudesind::Gallery
object.
METHODS
This class provides the following methods:
file()
The filesystem path, with file name, for this object.
filename()
Juse the filename, without the path.
path()
The
URI
path for this image.uri()
The value of
path()
both with ".html" appended. Provided for the use of the Mason UI. Usepath()
instead.title()
A title for the image. Currently, this is just the image's file name.
config()
The
Rudesind::Config
object given to the constructor.height()
The height of the image, in pixels.
width()
The width of the image, in pixels.
gallery()
The
Rudesind::Gallery
object containing this image.thumbnail_uri()
The URI for a thumbnail version of the image.
Calling this method will generate the thumbnail image if a cached version does not exist, using the
make_transformed_image_file('thumbnail')
method.thumbnail_image_file()
The filesystem path for this image's cached thumbnail. This method always returns a filename, whether or not the file actually exists.
has_thumbnail()
Indicates whether or not there is a cached thumbnail for this image.
transformed_uri(@transforms)
The URI for a transformed version of the image, based on the specified transforms.
Calling this method will generate the transformed image if a cached version does not exist, using the
make_transformed_image_file()
method.transformed_image_file(@transforms)
The filesystem path for this image's cached transformed version, based on the specified transforms. This method always returns a filename, whether or not the file actually exists.
has_transformed(@transforms)
Indicates whether or not there is a cached transformed version of this image, based on the specified transforms.
make_transformed_image_file(@transforms)
Creates a transformed version of the image according to the specified transforms and stores it in the cached images directory, if one doesn't already exist.
This method returns the filesystem path for the file.
Transforms
For any method that accepts transforms, you can specify any of the following:
default
The default image size and orientation. The maximum height and width allowed are the "image_page_max_height" and "image_page_max_width" configuration parameters.
thumbnail
The thumnail height and width of the image.
double
Doubles the image's size from the default, so that the maximum height and width allowed are twice the "image_page_max_height" and "image_page_max_width" configuration parameters.
rotate-90
Rotate the image 90 degrees clockwise. The maximum height and width allowed are the "image_page_max_height" and "image_page_max_width" configuration parameters.
rotate-180
Rotate the image 180 degrees. The maximum height and width allowed are the "image_page_max_height" and "image_page_max_width" configuration parameters.
rotate-270
Rotate the image 270 degrees clockwise. The maximum height and width allowed are the "image_page_max_height" and "image_page_max_width" configuration parameters.
It is possible to pass multiple transforms at once, so you could do this:
my $file = $image->make_transformed_image_file( 'double', 'rotate-90' );
This produces an image to which both the "double" and "rotate-90" transforms have been applied, in the specified order.
Captions
This class uses the Rudesind::Captioned
role.