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; } /** * Alter the information provided in hook_image_effect_info(). * * @param $effects * The array of image effects, keyed on the machine-readable effect name. * * @see hook_image_effect_info() */ function hook_image_effect_info_alter(&$effects) { // Override the Image module's crop effect with more options. $effects['image_crop']['effect callback'] = 'mymodule_crop_effect'; $effects['image_crop']['dimensions callback'] = 'mymodule_crop_dimensions'; $effects['image_crop']['form callback'] = 'mymodule_crop_form'; } /** * Respond to image style flushing. * * This hook enables modules to take effect when a style is being flushed (all * images are being deleted from the server and regenerated). Any * module-specific caches that contain information related to the style should * be cleared using this hook. This hook is called whenever a style is updated, * deleted, or any effect associated with the style is update or deleted. * * @param Drupal\image\Plugin\Core\Entity\ImageStyle $style * The image style array that is being flushed. */ function hook_image_style_flush($style) { // Empty cached data that contains information about the style. cache('mymodule')->deleteAll(); } /** * @} End of "addtogroup hooks". */