You are here

function imagick_update_8001 in Imagick 8

Update all convert effect operations.

File

./imagick.install, line 29

Code

function imagick_update_8001() {
  $styles = ImageStyle::loadMultiple();

  /** @var ImageStyle $style */
  foreach ($styles as $style) {

    /** @var ImageEffectInterface $effect */
    foreach ($style
      ->getEffects() as $effect) {
      if ($effect instanceof ConvertImageEffect) {

        // Update configuration
        $config = $effect
          ->getConfiguration();
        $config['data']['format'] = strtolower($config['data']['format']);

        // Save the effect
        $effect
          ->setConfiguration($config);
        $style
          ->save();
      }
    }
  }
}