1.20.x image.install image_update_1007()

Update from Image size to more specific Image dimensions.

Related topics

File

modules/image/image.install, line 342
Install, update and uninstall functions for the image module.

Code

function image_update_1007() {
  $config_names = config_get_names_with_prefix('field.instance.');
  foreach ($config_names as $config_name) {
    $config = config($config_name);
    if ($config->get('widget.type') == 'image_image') {
      $config->set('settings.max_dimensions', $config->get('settings.max_resolution'));
      $config->clear('settings.max_resolution');
      $config->set('settings.min_dimensions', $config->get('settings.min_resolution'));
      $config->clear('settings.min_resolution');
      $config->save();
    }
  }
}