NAME
IIIF::Request - IIIF Image API request object
SYNOPSIS
use IIIF::Request;
my $request = IIIF::Request->new('125,15,120,140/90,/!345/gray.jpg');
DESCRIPTION
Stores parts of an IIIF ImageAPI after {identifier}:
{region}/{size}/{rotation}/{quality}.{format}
In contrast to the IIIF Image API Specification, all parts are optional. Omitted parts are set to their default value, except for format which may be undefined. In addition, the following fields are set if deriveable form the request:
- region_pct
- region_px
- upscale
- size_pct
- size_px
- ratio
- mirror
- degree
Request parsing of percentage and degree values is also more forgiving than the specification.
METHODS
new( [ $request ] )
Parses a request string. It's ok to only include selected image manipulations. Will raise an error on invalid requests. The request is parsed independent from a specific image so regions and sizes outside of the image bound are not detected as invalid.
fits( $width, $height )
Check whether the request would be valid for an image of given width and height.
as_string
Returns the full request string. Percentage values and degrees are normalized.
is_default
Returns whether the request (without format) is the default request full/max/0/default to get an unmodified image.
error
Raise an "Invalid IIIF Image API Request" error. Can also be used as function.