123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * @file
- * Install, update, and uninstall functions for the image_example module.
- */
- /**
- * Implements hook_install().
- *
- * @ingroup image_example
- */
- function image_example_install() {
- // Set a variable containing the name of the style to use when the module
- // outputs an image.
- variable_set('image_example_style_name', 'image_example_style');
- }
- /**
- * Implements hook_uninstall().
- *
- * @ingroup image_example
- */
- function image_example_uninstall() {
- variable_del('image_example_style_name');
- variable_del('image_example_image_fid');
- }
- /**
- * Implements hook_enable().
- *
- * @ingroup image_example
- */
- function image_example_enable() {
- // There is currently no way to manually flush an image style which causes
- // problems when installing a new module that implements
- // hook_image_styles_alter(). If the new module modifies an image style that
- // modification will not be applied to any images that have already been
- // generated unless the styles are flushed. This is one way around that.
- $styles = image_styles();
- foreach ($styles as $style) {
- image_style_flush($style);
- }
- }
- /**
- * Implements hook_disable().
- *
- * @ingroup image_example
- */
- function image_example_disable() {
- // Solves the same problem as image_example_enable().
- image_example_enable();
- }
|