![]() |
CMS
Version 3.9
|
The ImageManager class provides basic Image manipulation functions that are useful when working with Image objects. More...
Public Member Functions | |
ImageManager () | |
Creates a new ImageManager. More... | |
renderThumbnail ($image_id, $size=0, $width=0, $height=0) | |
Renders the Image specified by the image_id at the specified size. More... | |
renderImage ($image_id) | |
Renders the specified image at its natural size. More... | |
resizeAndCropToFit ($image_id, $width, $height) | |
resizeAndCropToCover ($image_id, $width, $height) | |
getCachedFilePath ($image_id, $mode, $size) | |
cacheFilePath ($image_id, $mode, $size, $path) | |
iconize ($image_id, $size) | |
crop ($id, $x, $y, $w, $h) | |
Crop the image to the specified dimensions. More... | |
thumbnailLink ($image_id, $size, $iconize=false) | |
Returns the URI that can be used to access the specified image at the given size. More... | |
imageLink ($image_id) | |
getSize ($image_id, &$width, &$height) | |
Determines the size of the specified image. More... | |
getScaledSize ($image_id, $size, &$width, &$height) | |
Calculates the width and height of an image after it is scaled to the specified size along its major axis. More... | |
Static Public Member Functions | |
static | displayImageGallery ($identifier, &$continue) |
Event handler to display an image gallery from the specified identifier. More... | |
static | enumerateItems ($items) |
Enumerate the Image Gallery objects. More... | |
static | isPNG ($filename) |
Test the contents of the specified file, returning true if a PNG header signature is found. More... | |
static | isJPG ($filename) |
Test the contents of the specified file, returning true if a JPEG header signature is found. More... | |
static | imageUploadHandler ($field, $image) |
Upload the image file specified in the given field. More... | |
static | fixOrientation ($photo) |
Rotates the image to match the correct orientation when orientation information is included in the image file. More... | |
static | zipGallery ($gallery_id, $process=null) |
Generate a ZIP archive of all the images in the specified gallery. More... | |
static | imageGalleryTabs ($key) |
static | getStyles () |
static | setDefaults () |
static | registerTaxonomyClasses ($classes) |
static | upgradeComponent ($version) |
static | deleteUser ($user) |
Respond to fired event DeleteUser. More... | |
static | registerSerializationHandler () |
The ImageManager class provides basic Image manipulation functions that are useful when working with Image objects.
Definition at line 69 of file image_manager.inc.
ImageManager::cacheFilePath | ( | $image_id, | |
$mode, | |||
$size, | |||
$path | |||
) |
Definition at line 503 of file image_manager.inc.
ImageManager::crop | ( | $id, | |
$x, | |||
$y, | |||
$w, | |||
$h | |||
) |
Crop the image to the specified dimensions.
This operation is destructive - it overwrites the source file with the resulting crop.
integer | $id | the ID of the image to be cropped |
integer | $x | the left-hand coordinate to crop from |
integer | $y | the top coordinate to crop from |
integer | $w | the width to crop to |
integer | $h | the height to crop to |
Definition at line 664 of file image_manager.inc.
|
static |
Respond to fired event DeleteUser.
Delete any records in this component that have dependencies on user object.
obj | $user | - class SiteUser or custom user class |
Definition at line 1163 of file image_manager.inc.
|
static |
Event handler to display an image gallery from the specified identifier.
string | $identifier | the identifier to match |
boolean | $continue | returns whether to continue processing this event |
Definition at line 799 of file image_manager.inc.
|
static |
Enumerate the Image Gallery objects.
$items | collection that the ImageGallery items are returned in |
Definition at line 836 of file image_manager.inc.
|
static |
Rotates the image to match the correct orientation when orientation information is included in the image file.
Currently this only works for JPEGs. The target file is converted to a PNG in the rotation process so that the transformation is lossless.
string | $photo | path to the photo that is to be re-oriented |
Definition at line 1014 of file image_manager.inc.
ImageManager::getCachedFilePath | ( | $image_id, | |
$mode, | |||
$size | |||
) |
Definition at line 495 of file image_manager.inc.
ImageManager::getScaledSize | ( | $image_id, | |
$size, | |||
& | $width, | ||
& | $height | ||
) |
Calculates the width and height of an image after it is scaled to the specified size along its major axis.
$image_id | the ID of the image. |
$size | the required length of the major axis |
$width | returns the width of the scaled image |
$height | returns the height of the scaled image |
Definition at line 778 of file image_manager.inc.
ImageManager::getSize | ( | $image_id, | |
& | $width, | ||
& | $height | ||
) |
Determines the size of the specified image.
$image_id | the ID of the image to be queried. |
$width | returns the width of the image in pixels |
$height | returns the height of the image in pixels |
Definition at line 751 of file image_manager.inc.
|
static |
Definition at line 1127 of file image_manager.inc.
ImageManager::iconize | ( | $image_id, | |
$size | |||
) |
Definition at line 509 of file image_manager.inc.
|
static |
Definition at line 1115 of file image_manager.inc.
ImageManager::imageLink | ( | $image_id | ) |
Definition at line 740 of file image_manager.inc.
ImageManager::ImageManager | ( | ) |
|
static |
Upload the image file specified in the given field.
string | $field | the field name of the image file |
$image | the Image object the field is being uploaded to. |
Definition at line 921 of file image_manager.inc.
|
static |
Test the contents of the specified file, returning true if a JPEG header signature is found.
This is very rough and ready - only use it if you are pretty sure that the file you are being passed is an image.
string | $file | full path to the file |
Definition at line 886 of file image_manager.inc.
|
static |
Test the contents of the specified file, returning true if a PNG header signature is found.
string | $filename | full path to the file |
Definition at line 849 of file image_manager.inc.
|
static |
Definition at line 1176 of file image_manager.inc.
|
static |
Definition at line 1144 of file image_manager.inc.
ImageManager::renderImage | ( | $image_id | ) |
Renders the specified image at its natural size.
The image file is output with the correct HTTP headers to ensure correct interpretation by the browser.
$image_id | the ID of the image to be rendered. |
Definition at line 253 of file image_manager.inc.
ImageManager::renderThumbnail | ( | $image_id, | |
$size = 0 , |
|||
$width = 0 , |
|||
$height = 0 |
|||
) |
Renders the Image specified by the image_id at the specified size.
Note that the size is the length of the major axis, and aspect ratio is maintained. The generated image is cached after rendering to speed subsequent accesses. The image file is output with the correct HTTP headers to ensure correct interpretation by the browser.
$image_id | the ID of the image to render |
$size | the size of the major axis, in pixels |
$width | the specific width of the rendered thumbnail (if $size is 0) |
$height | the specific height of the rendered thumbnail (if $size and $width are 0) |
Definition at line 90 of file image_manager.inc.
ImageManager::resizeAndCropToCover | ( | $image_id, | |
$width, | |||
$height | |||
) |
Definition at line 369 of file image_manager.inc.
ImageManager::resizeAndCropToFit | ( | $image_id, | |
$width, | |||
$height | |||
) |
Definition at line 262 of file image_manager.inc.
|
static |
Definition at line 1134 of file image_manager.inc.
ImageManager::thumbnailLink | ( | $image_id, | |
$size, | |||
$iconize = false |
|||
) |
Returns the URI that can be used to access the specified image at the given size.
$image_id | the ID of the image |
$size | the size of the major axis in pixels |
$iconize | if set to true, the image is squared of with the edge length being the specified size. |
Definition at line 734 of file image_manager.inc.
|
static |
Definition at line 1150 of file image_manager.inc.
|
static |
Generate a ZIP archive of all the images in the specified gallery.
integer | $gallery_id | the ID of the gallery to be zipped |
Definition at line 1058 of file image_manager.inc.