function picture_get_image_dimensions in Picture 7
Same name and namespace in other branches
- 7.2 picture.module \picture_get_image_dimensions()
Determines the dimensions of an image.
Parameters
$variables: An associative array containing:
- style_name: The name of the style to be used to alter the original image.
- width: The width of the source image (if known).
- height: The height of the source image (if known).
$multiplier: Multiplier from the source
Return value
array Dimensions to be modified - an array with components width and height, in pixels.
1 call to picture_get_image_dimensions()
- theme_picture in ./
picture.module - Returns HTML for a picture.
File
- ./
picture.module, line 1146 - Picture formatter.
Code
function picture_get_image_dimensions($variables, $multiplier = 1) {
// Determine the dimensions of the styled image.
$dimensions = array();
if (isset($variables['width'])) {
$dimensions['width'] = $variables['width'];
}
if (isset($variables['height'])) {
$dimensions['height'] = $variables['height'];
}
if ($variables['style_name'] == PICTURE_EMPTY_IMAGE) {
$dimensions = array(
'width' => 1,
'height' => 1,
);
}
elseif ($variables['style_name'] == PICTURE_ORIGINAL_IMAGE) {
// NOOP.
}
else {
image_style_transform_dimensions($variables['style_name'], $dimensions);
if ($multiplier != 0 && $multiplier != 1) {
$dimensions['width'] = ceil($dimensions['width'] / $multiplier);
$dimensions['height'] = ceil($dimensions['height'] / $multiplier);
}
}
return $dimensions;
}