imagecache.api.php in ImageCache 6.2
Hooks provided by the ImageCache module.
File
imagecache.api.phpView source
<?php
/**
* @file
* Hooks provided by the ImageCache module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Inform ImageCache about actions that can be performed on an image.
*
* @return array
* An array of information on the actions implemented by a module. The array
* contains a sub-array for each action node type, with the machine-readable
* action name as the key. Each sub-array has up to 3 attributes. Possible
* attributes:
* "name": the human-readable name of the action. Required.
* "description": a brief description of the action. Required.
* "file": the name of the include file the action can be found
* in relative to the implementing module's path.
*/
function hook_imagecache_actions() {
$actions = array(
'imagecache_resize' => array(
'name' => 'Resize',
'description' => 'Resize an image to an exact set of dimensions, ignoring aspect ratio.',
),
);
return $actions;
}
/**
* Provides default ImageCache presets that can be overridden by site
* administrators.
*
* @return array
* An array of imagecache preset definitions. Each definition can be
* generated by exporting a preset from the database. Each preset
* definition should be keyed on its presetname (for easier interaction
* with drupal_alter) and have the following attributes:
* "presetname": the imagecache preset name. Required.
* "actions": an array of action defintions for this preset. Required.
*/
function hook_imagecache_default_presets() {
$presets = array();
$presets['thumbnail'] = array(
'presetname' => 'thumbnail',
'actions' => array(
0 => array(
'weight' => '0',
'module' => 'imagecache',
'action' => 'imagecache_scale_and_crop',
'data' => array(
'width' => '60',
'height' => '60',
),
),
),
);
return $presets;
}
/**
* Allows other modules to perform actions on an image before it is flushed.
*
* This hook can be used to send purge requests to a reverse proxy or delete
* a file from a remote file server or CDN when the imagecached version is
* flushed.
*
* Implementations of hook_imagecache_image_flush should not delete the image
* at $filepath, as ImageCache will perform this action.
*
* @param $derivative_path
* The path to the file about to be flushed.
* @param $preset
* An ImageCache preset array.
* @param $original_path
* The Drupal file path to the original image.
*/
function hook_imagecache_image_flush($derivative_path, $preset, $original_path) {
}
/**
* Allows other modules to perform actions when a preset is about to be flushed.
*
* This hook can be used to send purge requests to a reverse proxy or delete
* files from a remote file server or CDN when the imagecached versions are
* flushed.
*
* Implementations of hook_imagecache_preset_flush should not delete the
* images in $presetdir, as ImageCache will perform this action.
*
* @param $presetdir
* The directory containing the images about to be flushed.
* @param $preset
* An ImageCache preset array.
*/
function hook_imagecache_preset_flush($presetdir, $preset) {
}
Functions
Name | Description |
---|---|
hook_imagecache_actions | Inform ImageCache about actions that can be performed on an image. |
hook_imagecache_default_presets | Provides default ImageCache presets that can be overridden by site administrators. |
hook_imagecache_image_flush | Allows other modules to perform actions on an image before it is flushed. |
hook_imagecache_preset_flush | Allows other modules to perform actions when a preset is about to be flushed. |