@@ -247,8 +247,8 @@ |
||
| 247 | 247 | |
| 248 | 248 | // enable |
| 249 | 249 | if ($this->new_fileName === 0 |
| 250 | - || !\is_array($GLOBALS['TSFE']->tmpl->setup['config.']['fl_realurl_image.']) // no static template |
|
| 251 | - || strtolower($this->new_fileName) === 'off' // fl_realurl_image switched off on this page |
|
| 250 | + || !\is_array($GLOBALS['TSFE']->tmpl->setup['config.']['fl_realurl_image.']) // no static template |
|
| 251 | + || strtolower($this->new_fileName) === 'off' // fl_realurl_image switched off on this page |
|
| 252 | 252 | |
| 253 | 253 | ) { |
| 254 | 254 | $this->enable = false; |
@@ -51,42 +51,42 @@ discard block |
||
| 51 | 51 | return $src; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - try { |
|
| 55 | - $imageService = self::getImageService(); |
|
| 56 | - $image = $imageService->getImage($src, $image, $treatIdAsReference); |
|
| 54 | + try { |
|
| 55 | + $imageService = self::getImageService(); |
|
| 56 | + $image = $imageService->getImage($src, $image, $treatIdAsReference); |
|
| 57 | 57 | |
| 58 | - if ($cropString === null && $image->hasProperty('crop') && $image->getProperty('crop')) { |
|
| 59 | - $cropString = $image->getProperty('crop'); |
|
| 60 | - } |
|
| 58 | + if ($cropString === null && $image->hasProperty('crop') && $image->getProperty('crop')) { |
|
| 59 | + $cropString = $image->getProperty('crop'); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $cropVariantCollection = CropVariantCollection::create((string)$cropString); |
|
| 63 | - $cropVariant = $arguments['cropVariant'] ?: 'default'; |
|
| 64 | - $cropArea = $cropVariantCollection->getCropArea($cropVariant); |
|
| 65 | - $processingInstructions = [ |
|
| 66 | - 'width' => $arguments['width'], |
|
| 67 | - 'height' => $arguments['height'], |
|
| 68 | - 'minWidth' => $arguments['minWidth'], |
|
| 69 | - 'minHeight' => $arguments['minHeight'], |
|
| 70 | - 'maxWidth' => $arguments['maxWidth'], |
|
| 71 | - 'maxHeight' => $arguments['maxHeight'], |
|
| 72 | - 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image), |
|
| 73 | - ]; |
|
| 62 | + $cropVariantCollection = CropVariantCollection::create((string)$cropString); |
|
| 63 | + $cropVariant = $arguments['cropVariant'] ?: 'default'; |
|
| 64 | + $cropArea = $cropVariantCollection->getCropArea($cropVariant); |
|
| 65 | + $processingInstructions = [ |
|
| 66 | + 'width' => $arguments['width'], |
|
| 67 | + 'height' => $arguments['height'], |
|
| 68 | + 'minWidth' => $arguments['minWidth'], |
|
| 69 | + 'minHeight' => $arguments['minHeight'], |
|
| 70 | + 'maxWidth' => $arguments['maxWidth'], |
|
| 71 | + 'maxHeight' => $arguments['maxHeight'], |
|
| 72 | + 'crop' => $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($image), |
|
| 73 | + ]; |
|
| 74 | 74 | |
| 75 | - $processedImage = $imageService->applyProcessingInstructions($image, $processingInstructions); |
|
| 76 | - return $imageService->getImageUri($processedImage, $absolute); |
|
| 77 | - } catch (ResourceDoesNotExistException $e) { |
|
| 78 | - // thrown if file does not exist |
|
| 79 | - throw new Exception($e->getMessage(), 1509741907, $e); |
|
| 80 | - } catch (\UnexpectedValueException $e) { |
|
| 81 | - // thrown if a file has been replaced with a folder |
|
| 82 | - throw new Exception($e->getMessage(), 1509741908, $e); |
|
| 83 | - } catch (\RuntimeException $e) { |
|
| 84 | - // RuntimeException thrown if a file is outside of a storage |
|
| 85 | - throw new Exception($e->getMessage(), 1509741909, $e); |
|
| 86 | - } catch (\InvalidArgumentException $e) { |
|
| 87 | - // thrown if file storage does not exist |
|
| 88 | - throw new Exception($e->getMessage(), 1509741910, $e); |
|
| 89 | - } |
|
| 75 | + $processedImage = $imageService->applyProcessingInstructions($image, $processingInstructions); |
|
| 76 | + return $imageService->getImageUri($processedImage, $absolute); |
|
| 77 | + } catch (ResourceDoesNotExistException $e) { |
|
| 78 | + // thrown if file does not exist |
|
| 79 | + throw new Exception($e->getMessage(), 1509741907, $e); |
|
| 80 | + } catch (\UnexpectedValueException $e) { |
|
| 81 | + // thrown if a file has been replaced with a folder |
|
| 82 | + throw new Exception($e->getMessage(), 1509741908, $e); |
|
| 83 | + } catch (\RuntimeException $e) { |
|
| 84 | + // RuntimeException thrown if a file is outside of a storage |
|
| 85 | + throw new Exception($e->getMessage(), 1509741909, $e); |
|
| 86 | + } catch (\InvalidArgumentException $e) { |
|
| 87 | + // thrown if file storage does not exist |
|
| 88 | + throw new Exception($e->getMessage(), 1509741910, $e); |
|
| 89 | + } |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected static function getImageService() |
| 98 | 98 | { |
| 99 | - /** @var ObjectManager $objectManager */ |
|
| 100 | - $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
|
| 101 | - return $objectManager->get(ImageService::class); |
|
| 99 | + /** @var ObjectManager $objectManager */ |
|
| 100 | + $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
|
| 101 | + return $objectManager->get(ImageService::class); |
|
| 102 | 102 | } |
| 103 | 103 | } |
@@ -53,8 +53,8 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | protected function getImageService():ImageService |
| 55 | 55 | { |
| 56 | - /** @var ImageService $imageService */ |
|
| 57 | - $imageService = GeneralUtility::makeInstance(ImageService::class); |
|
| 58 | - return $imageService; |
|
| 56 | + /** @var ImageService $imageService */ |
|
| 57 | + $imageService = GeneralUtility::makeInstance(ImageService::class); |
|
| 58 | + return $imageService; |
|
| 59 | 59 | } |
| 60 | 60 | } |