[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/imagecache/ -> imagecache.api.php (source)

   1  <?php
   2  
   3  /**
   4   * @file
   5   * Hooks provided by the ImageCache module.
   6   */
   7  
   8  /**
   9   * @addtogroup hooks
  10   * @{
  11   */
  12  
  13  /**
  14   * Inform ImageCache about actions that can be performed on an image.
  15   *
  16   * @return array
  17   *   An array of information on the actions implemented by a module. The array
  18   *   contains a sub-array for each action node type, with the machine-readable
  19   *   action name as the key. Each sub-array has up to 3 attributes. Possible
  20   *   attributes:
  21   *     "name": the human-readable name of the action. Required.
  22   *     "description": a brief description of the action. Required.
  23   *     "file": the name of the include file the action can be found
  24   *             in relative to the implementing module's path.
  25   */
  26  function hook_imagecache_actions() {
  27    $actions = array(
  28      'imagecache_resize' => array(
  29        'name' => 'Resize',
  30        'description' => 'Resize an image to an exact set of dimensions, ignoring aspect ratio.',
  31      ),
  32    );
  33  }
  34  
  35  /**
  36   * Provides default ImageCache presets that can be overridden by site
  37   * administrators.
  38   *
  39   * @return array
  40   *   An array of imagecache preset definitions. Each definition can be
  41   *   generated by exporting a preset from the database. Each preset
  42   *   definition should be keyed on its presetname (for easier interaction
  43   *   with drupal_alter) and have the following attributes:
  44   *     "presetname": the imagecache preset name. Required.
  45   *     "actions": an array of action defintions for this preset. Required.
  46   */
  47  function hook_imagecache_default_presets() {
  48    $presets = array();
  49    $presets['thumbnail'] = array (
  50      'presetname' => 'thumbnail',
  51      'actions' => array (
  52        0 => array (
  53          'weight' => '0',
  54          'module' => 'imagecache',
  55          'action' => 'imagecache_scale_and_crop',
  56          'data' => array (
  57            'width' => '60',
  58            'height' => '60',
  59          ),
  60        ),
  61      ),
  62    );
  63    return $presets;
  64  }
  65  
  66  /**
  67   * Allows other modules to perform actions on an image before it is flushed.
  68   *
  69   * This hook can be used to send purge requests to a reverse proxy or delete
  70   * a file from a remote file server or CDN when the imagecached version is
  71   * flushed.
  72   *
  73   * Implementations of hook_imagecache_image_flush should not delete the image
  74   * at $filepath, as ImageCache will perform this action.
  75   *
  76   * @param $derivative_path
  77   *   The path to the file about to be flushed.
  78   * @param $preset
  79   *   An ImageCache preset array.
  80   * @param $original_path
  81   *   The Drupal file path to the original image.
  82   */
  83  function hook_imagecache_image_flush($derivative_path, $preset, $original_path) {
  84  }
  85  
  86  /**
  87   * Allows other modules to perform actions when a preset is about to be flushed.
  88   *
  89   * This hook can be used to send purge requests to a reverse proxy or delete
  90   * files from a remote file server or CDN when the imagecached versions are
  91   * flushed.
  92   *
  93   * Implementations of hook_imagecache_preset_flush should not delete the
  94   * images in $presetdir, as ImageCache will perform this action.
  95   *
  96   * @param $presetdir
  97   *   The directory containing the images about to be flushed.
  98   * @param $preset
  99   *   An ImageCache preset array.
 100   */
 101  function hook_imagecache_preset_flush($presetdir, $preset) {
 102  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7