You are here

function designkit_image_default_styles in DesignKit 7

Implements hook_image_default_styles().

File

./designkit.module, line 84

Code

function designkit_image_default_styles() {
  $styles = array();

  // Generate image styles per image entry in theme info.
  $info = designkit_get_info();
  if (!empty($info['designkit']['image'])) {
    foreach ($info['designkit']['image'] as $name => $image_info) {
      if (isset($image_info['effect'])) {
        list($effect, $dimensions) = explode(':', $image_info['effect']);
        list($width, $height) = explode('x', $dimensions);
        $valid_effects = image_effect_definitions();
        if (isset($valid_effects[$effect]) && is_numeric($width) && is_numeric($height)) {
          $styles["designkit-image-{$name}"] = array(
            'effects' => array(
              array(
                'weight' => 0,
                'name' => $effect,
                'data' => array(
                  // @TODO: decide what to do with this hardcoded param.
                  'fit' => 'inside',
                  'upscale' => 1,
                  'width' => $width,
                  'height' => $height,
                ),
              ),
            ),
          );
        }
      }
    }
  }
  return $styles;
}