function _media_crop_apply_crop in Media crop 7
Helper function to apply crop to an image.
Parameters
int $crop_width: Width of the crop.
int $crop_height: Height of the crop.
int $crop_x_coordinate: X coordinate of the crop.
int $crop_y_coordinate: Y coordinate of the crop.
object $image: Image object to modify.
1 call to _media_crop_apply_crop()
- media_crop_create_derivative in ./
media_crop.module - Helper function to create a derivative of an image.
File
- ./
media_crop.module, line 784 - Media crop primary module file.
Code
function _media_crop_apply_crop($crop_width, $crop_height, $crop_x_coordinate, $crop_y_coordinate, $image) {
if ($crop_width && $crop_height) {
$image_width = $image->info['width'];
$image_height = $image->info['height'];
image_effect_apply($image, array(
'name' => 'image_crop',
'data' => array(
'width' => (int) _media_crop_scale($image_width, $image_height, $crop_width),
'height' => (int) _media_crop_scale($image_width, $image_height, $crop_height),
'anchor' => (int) _media_crop_scale($image_width, $image_height, $crop_x_coordinate) . '-' . (int) _media_crop_scale($image_width, $image_height, $crop_y_coordinate),
),
) + image_effect_definition_load('image_crop'));
}
}