From 7dac3efd549986b4ec7c9e7a07bebf5993d4ea54 Mon Sep 17 00:00:00 2001 From: Helmut Hummel <typo3@helhum.io> Date: Mon, 27 Mar 2017 19:09:29 +0200 Subject: [PATCH] [BUGFIX] Avoid calculating crop areas, when files have no size When file relations are added, the crop area of these is calculated, even if they are not images. We avoid that by only doing this processing, when the file has a width property. Resolves: #80071 Releases: master Change-Id: I42924b271e5a6697d35ffb7d5f322f555139ec57 Reviewed-on: https://review.typo3.org/52192 Reviewed-by: Thomas Hohn <thomas@hohn.dk> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> --- .../backend/Classes/Form/Element/ImageManipulationElement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php b/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php index b87eb48258af..85f7677f8411 100644 --- a/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php @@ -289,11 +289,11 @@ class ImageManipulationElement extends AbstractFormElement protected function processConfiguration(array $config, string &$elementValue, File $file) { $cropVariantCollection = CropVariantCollection::create($elementValue, $config['cropVariants']); - if (empty($config['readOnly'])) { + if (empty($config['readOnly']) && !empty($file->getProperty('width'))) { $cropVariantCollection = $cropVariantCollection->applyRatioRestrictionToSelectedCropArea($file); + $elementValue = (string)$cropVariantCollection; } $config['cropVariants'] = $cropVariantCollection->asArray(); - $elementValue = (string)$cropVariantCollection; $config['allowedExtensions'] = implode(', ', GeneralUtility::trimExplode(',', $config['allowedExtensions'], true)); return $config; } -- GitLab