function drush_image_flush

8.0.x image.drush.inc drush_image_flush($style_name = NULL)
6.x image.drush.inc drush_image_flush($style_name = NULL)
7.x image.drush.inc drush_image_flush($style_name = NULL)
4.x image.drush.inc drush_image_flush($style_name = NULL)
5.x image.drush.inc drush_image_flush($style_name = NULL)
master image.drush.inc drush_image_flush($style_name = NULL)

File

commands/core/image.drush.inc, line 33
Image module's drush integration.

Code

function drush_image_flush($style_name = NULL) {
  if (drush_get_option('all')) {
    drush_image_flush_all();
  }
  elseif (empty($style_name)) {
    $choices = drupal_map_assoc(array_keys(image_styles()));
    $choices = array_merge(array('all' => 'all'), $choices);
    $style_name = drush_choice($choices, dt("Choose a style to flush."));
    if ($style_name == 'all') {
      drush_image_flush_all();
    }
    else {
      $commands = drush_get_commands();
      return drush_dispatch($commands['image-flush'], array($style_name));
    }
  }
  else {
    if ($style = image_style_load($style_name)) {
      image_style_flush($style);
      drush_log(dt('Image style !style_name flushed', array('!style_name' => $style_name)), 'success');
    }
    else {
      return drush_set_error(dt('Image style !style not recognized.', array('!style' => $style_name)));
    }
  }
}