123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <?php
- function hook_image_effect_info() {
- $effects = array();
- $effects['mymodule_resize'] = array(
- 'label' => t('Resize'),
- 'help' => t('Resize an image to an exact set of dimensions, ignoring aspect ratio.'),
- 'effect callback' => 'mymodule_resize_effect',
- 'dimensions callback' => 'mymodule_resize_dimensions',
- 'form callback' => 'mymodule_resize_form',
- 'summary theme' => 'mymodule_resize_summary',
- );
- return $effects;
- }
- function hook_image_effect_info_alter(&$effects) {
-
- $effects['image_crop']['effect callback'] = 'mymodule_crop_effect';
- $effects['image_crop']['dimensions callback'] = 'mymodule_crop_dimensions';
- $effects['image_crop']['form callback'] = 'mymodule_crop_form';
- }
- function hook_image_style_save($style) {
-
-
- if (isset($style['old_name']) && $style['old_name'] == variable_get('mymodule_image_style', '')) {
- variable_set('mymodule_image_style', $style['name']);
- }
- }
- function hook_image_style_delete($style) {
-
-
- if (isset($style['old_name']) && $style['old_name'] == variable_get('mymodule_image_style', '')) {
- variable_set('mymodule_image_style', $style['name']);
- }
- }
- function hook_image_style_flush($style) {
-
- cache_clear_all('*', 'cache_mymodule', TRUE);
- }
- function hook_image_styles_alter(&$styles) {
-
- if ($styles['thumbnail']['storage'] == IMAGE_STORAGE_DEFAULT) {
-
- $styles['thumbnail']['effects'][] = array(
- 'name' => 'image_desaturate',
- 'data' => array(),
- 'weight' => 1,
- 'effect callback' => 'image_desaturate_effect',
- );
- }
- }
- function hook_image_default_styles() {
- $styles = array();
- $styles['mymodule_preview'] = array(
- 'effects' => array(
- array(
- 'name' => 'image_scale',
- 'data' => array('width' => 400, 'height' => 400, 'upscale' => 1),
- 'weight' => 0,
- ),
- array(
- 'name' => 'image_desaturate',
- 'data' => array(),
- 'weight' => 1,
- ),
- ),
- );
- return $styles;
- }
-
|