Image effect callback; Scale an image resource.
object $image: An image object returned by image_load().
array $data: An array of attributes to use when performing the scale effect with the following items:
bool TRUE on success. FALSE on failure to scale image.
function image_scale_effect($image, array $data) {
// Set sane default values.
$data += array(
'width' => NULL,
'height' => NULL,
'upscale' => FALSE,
);
if (!image_scale($image, $data['width'], $data['height'], $data['upscale'])) {
watchdog('image', 'Image scale failed using the %toolkit toolkit on %path (%mimetype, %dimensions)', array(
'%toolkit' => $image->toolkit
->getPluginId(),
'%path' => $image->source,
'%mimetype' => $image->info['mime_type'],
'%dimensions' => $image->info['width'] . 'x' . $image->info['height'],
), WATCHDOG_ERROR);
return FALSE;
}
return TRUE;
}