Install, update, and uninstall functions for the image_example module.
<?php /** * @file * Install, update, and uninstall functions for the image_example module. */ /** * Implements hook_install(). * * @ingroup image_example */ function image_example_install() { // Set config containing the name of the style to use when the module // outputs an image. $config = config('image_example.settings'); $config->set('image_example_style_name', 'image_example_style'); $config->set('image_example_image_fid', FALSE); $config->save(); } /** * 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(); }