3 use Drush\Log\LogLevel;
7 * Specific functions for a Drupal image handling.
8 * drush_include_engine() magically includes either this file
9 * or image_X.inc depending on which version of Drupal
13 function drush_image_styles() {
14 return image_styles();
17 function drush_image_style_load($style_name) {
18 return image_style_load($style_name);
21 function drush_image_flush_single($style_name) {
22 if ($style = image_style_load($style_name)) {
23 image_style_flush($style);
24 drush_log(dt('Image style !style_name flushed', array('!style_name' => $style_name)), LogLevel::SUCCESS);
29 * Command callback. Create an image derivative.
31 * @param string $style_name
32 * The name of an image style.
34 * @param string $source
35 * The path to a source image, relative to Drupal root.
37 function _drush_image_derive($style_name, $source) {
38 $image_style = image_style_load($style_name);
39 $scheme = file_default_scheme();
40 $image_uri = $scheme . '://' . $source;
41 $derivative_uri = image_style_path($image_style['name'], $image_uri);
42 if (image_style_create_derivative($image_style, $source, $derivative_uri)) {
43 return $derivative_uri;