array('width' => '', 'height' => '', 'label' => t('Original'), 'operation' => 'scale', 'link' => IMAGE_LINK_SHOWN), IMAGE_THUMBNAIL => array('width' => 100, 'height' => 100, 'label' => t('Thumbnail'), 'operation' => 'scale', 'link' => IMAGE_LINK_SHOWN), IMAGE_PREVIEW => array('width' => 640, 'height' => 640, 'label' => t('Preview'), 'operation' => 'scale', 'link' => IMAGE_LINK_SHOWN), ); $sizes = array(); foreach (variable_get('image_sizes', $defaults) as $key => $val) { // Only return sizes with a label. if (!empty($val['label'])) { // For a size with only one dimension specified, compute the other // dimension based on an aspect ratio. if ($aspect_ratio && (empty($val['width']) || empty($val['height']))) { if (empty($val['height']) && !empty($val['width'])) { $val['height'] = (int)round($val['width'] * $aspect_ratio); } elseif (empty($val['width']) && !empty($val['height'])) { $val['width'] = (int)round($val['height'] / $aspect_ratio); } } $sizes[$key] = $val; } } // If they requested a specific size return only that. if (isset($size)) { // Only return an array if it's available. return isset($sizes[$size]) ? $sizes[$size] : FALSE; } return $sizes; } /** * Helper function to preserve backwards compatibility. This has been * deprecated in favor of image_get_sizes(). * * @TODO: Remove this in a future version. */ function _image_get_sizes($size = NULL, $aspect_ratio = NULL) { return image_get_sizes($size, $aspect_ratio); } /** * Is a given size a built-in, required size? * * @param $size * One of the keys in the array returned by image_get_sizes(). * * @return boolean */ function _image_is_required_size($size) { return in_array($size, array(IMAGE_THUMBNAIL, IMAGE_PREVIEW, IMAGE_ORIGINAL)); }