function _imagefield_crop_resize in Imagefield Crop 7
Same name and namespace in other branches
- 5 imagefield_crop.module \_imagefield_crop_resize()
- 6 imagefield_crop_widget.inc \_imagefield_crop_resize()
- 7.3 imagefield_crop.module \_imagefield_crop_resize()
- 7.2 imagefield_crop.module \_imagefield_crop_resize()
Crop the image and resize it.
1 call to _imagefield_crop_resize()
- imagefield_crop_widget_value in ./
imagefield_crop.module - value callback
File
- ./
imagefield_crop.module, line 517 - Provide a widget to crop uploaded image.
Code
function _imagefield_crop_resize($src, $crop = NULL, $scale = NULL, $dst = NULL) {
$image = image_load($src);
if ($image) {
$data = array(
'image' => &$image,
'crop' => &$crop,
'scale' => &$scale,
'src' => &$src,
'dst' => &$dst,
);
drupal_alter('imagefield_crop_resize', $data);
$result = TRUE;
if ($crop) {
$result = $result && image_crop($image, $crop['x'], $crop['y'], $crop['width'], $crop['height']);
}
if ($scale) {
$result = $result && image_scale_and_crop($image, $scale['width'], $scale['height']);
}
$result = $result && image_save($image, $dst ? $dst : $src);
return $result;
}
return FALSE;
}