diff --git a/manualcrop.module b/manualcrop.module index f516bb4..34c3191 100644 --- a/manualcrop.module +++ b/manualcrop.module @@ -989,25 +989,12 @@ function manualcrop_auto_reuse_effect(&$image, $data) { * directory. */ function manualcrop_crop_and_scale_transform_dimensions(array &$dimensions, array $data) { - // In crop_and_scale transformation dimensions aren't changed except when the - // image is smaller than the crop area but upscale is not enabled. - if (!$data['upscale'] && ($dimensions['width'] < $data['width'] || $dimensions['height'] < $data['height'])) { - $crop = manualcrop_load_crop_selection($data['path'], $data["style_name"]); - // If we have crop area defined, use it. - if ($crop) { - $dimensions["width"] = $crop->width; - $dimensions["height"] = $crop->height; - } - else { - // otherwise dimensions won't change. - $dimensions["width"] = $data['width']; - $dimensions["height"] = $data['height']; - } - } - else { - $dimensions["width"] = $data['width']; - $dimensions["height"] = $data['height']; - } + // Known limitation: in the crop_and_scale transformation the dimensions + // assigned below will not be correct if upscaling is disallowed and the image + // is smaller than the crop area. The workaround is to ensure the image field + // enforces a minimum image size. + $dimensions["width"] = $data['width']; + $dimensions["height"] = $data['height']; } /** @@ -1049,7 +1036,7 @@ function manualcrop_crop_transform_dimensions(array &$dimensions, array $data) { * @see manualcrop_crop_and_scale_transform_dimensions() */ function manualcrop_reuse_transform_dimensions(array &$dimensions, array $data) { - image_style_transform_dimensions($data['reuse_crop_style'], $dimensions, $data['path']); + image_style_transform_dimensions($data['reuse_crop_style'], $dimensions); } /** @@ -1068,10 +1055,10 @@ function manualcrop_auto_reuse_transform_dimensions(array &$dimensions, array $d $style_name = _manualcrop_get_auto_reuse_style_name($data['path'], $data); if ($style_name) { - image_style_transform_dimensions($style_name, $dimensions, $data['path']); + image_style_transform_dimensions($style_name, $dimensions); } elseif (!empty($data['fallback_style'])) { - image_style_transform_dimensions($data['fallback_style'], $dimensions, $data['path']); + image_style_transform_dimensions($data['fallback_style'], $dimensions); } }