NAME

Labyrinth::Media - Media files handler for Labyrinth

DESCRIPTION

This module collates many media and image file handling functionality used within Labyrinth.

It should be noted that internally images and media files are stored in the same, although images also record dimensions. When retrieving the required files, it is recommend you call the appropriate method to ensure you are getting the correct format of data for the file format. For example, GetImage and GetMedia, both return file information, but GetImage adds deminsion data.

Also note that Images and Photos differ in the directory structure storage, so saving and copying need to reference different functions. See below for a more detailed explanation.

PUBLIC INTERFACE FUNCTIONS

Stock Control Functions

CGIFile

When uploading a file via a web form, this function will save the file to the local filesystem.

Stock Control Functions

The stock list relates to the directory paths where uploaded files should be saved on the local filesystem.

StockName

Return the name for the given stock id.

StockPath

Return the path for the given stock id.

StockType

Return the stock id for the given stock code.

StockSelect

Returns an XHTML snippet for a dropdown selection box of stock entries.

PathMove

Image Functions

GetImage($imageid)

Retrieves the image data for a given imageid.

SaveImageFile(%hash)

Saves an uploaded image file into the specified directory structure. If not save directory is specified, the draft folder is used. The hash can contain the following:

param     - the CGI parameter used to reference the upload file
width     - maximum saved width (default = 120px)
height    - maximum saved height (default = 120px)
imageid   - if overwriting already existing file
stock     - file category (used to define the save directory)
MirrorImageFile

Mirrors a file from a URL to the local file system.

GetImageSize

For a given file, returns the true width and height that will be rendered within the browser, given the current and default settings.

GetGravatar

Returns a Gravatar link.

Image Functions

CopyPhotoFile()

Copy an existing stored image, both on the filesystem and in the database.

SavePhotoFile()

Save a photo uploaded via a web form to the local filesystem and to the photo gallery database table.

Media Functions

GetMedia($imageid)

Retrieves the media data for a given imageid.

SaveMediaFile(%hash)

Saves an uploaded media file into the specified directory structure. If no save directory is specified, the draft folder is used. The hash can contain the following:

param     - the CGI parameter used to reference the upload file
imageid   - if overwriting already existing file
stock     - file category (used to define the save directory)
SaveFile(%hash)

Saves an uploaded media file into the specified directory structure. If no save directory is specified, the draft folder is used. The hash can contain the following:

param     - the CGI parameter used to reference the upload file
stock     - file category (used to define the save directory)

Note that this upload function assumes that the file is to be stored in the appropriate directory with a link being return. No imageid or further reference is held within the database.

ADMIN INTERFACE FUNCTIONS

ImageCheck

Used by Images::Delete to verify whether a particular module uses a particular image referenced in the database.

LOCAL INTERNAL FUNCTIONS

SaveImage

Writes image data to the database.

UnZipFile

Un wraps an archive file and stores it in an appropriate directory. For a single file archive, the path to the file is returned. For collecions of files, an 'index.html' is searched for and the path to it returned if found. In all other instances the either the path to the first HTML file or first other file is returned.

SEE ALSO

Labyrinth

AUTHOR

Barbie, <barbie@missbarbell.co.uk> for Miss Barbell Productions, http://www.missbarbell.co.uk/

COPYRIGHT & LICENSE

Copyright (C) 2002-2011 Barbie for Miss Barbell Productions
All Rights Reserved.

This module is free software; you can redistribute it and/or
modify it under the Artistic License 2.0.