function imagecache_deprecated_scale_image in ImageCache 6.2
Same name and namespace in other branches
- 5.2 imagecache_actions.inc \imagecache_deprecated_scale_image()
File
- ./
imagecache_actions.inc, line 126
Code
function imagecache_deprecated_scale_image(&$image, $data) {
if ($data['fit'] == 'outside' && $data['width'] && $data['height']) {
$ratio = $image->info['width'] / $image->info['height'];
$new_ratio = $data['width'] / $data['height'];
$data['width'] = $ratio > $new_ratio ? 0 : $data['width'];
$data['height'] = $ratio < $new_ratio ? 0 : $data['height'];
}
// Set impossibly large values if the width and height aren't set.
$data['width'] = $data['width'] ? $data['width'] : 9999999;
$data['height'] = $data['height'] ? $data['height'] : 9999999;
if (!imageapi_image_scale($image, $data['width'], $data['height'])) {
watchdog('imagecache', 'imagecache_deprecated_scale failed. image: %image, data: %data.', array(
'%image' => $image->source,
'%data' => print_r($data, TRUE),
), WATCHDOG_ERROR);
return FALSE;
}
return TRUE;
}