summaryrefslogtreecommitdiffstats
path: root/imagecache.api.php
blob: 3c1a1a4df950c2ba295ab7e076221ce6826a6c89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
// $Id$

/**
 * @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.',
    ),
  );
}

/**
 * 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;
}