File tree Expand file tree Collapse file tree
Classes/ViewHelpers/Image/Modify Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66use Sitegeist \MediaComponents \Domain \Model \ImageSource ;
77use SMS \FluidComponents \Interfaces \ImageWithDimensions ;
8+ use SMS \FluidComponents \Interfaces \ProcessableImage ;
89use TYPO3Fluid \Fluid \Core \ViewHelper \AbstractViewHelper ;
910
1011class ScaleViewHelper extends AbstractViewHelper
@@ -20,9 +21,17 @@ public function initializeArguments(): void
2021 public function render (): ImageSource
2122 {
2223 $ imageSource = $ this ->arguments ['imageSource ' ] ?? $ this ->renderChildren ();
23- if (!($ imageSource ->getOriginalImage () instanceof ImageWithDimensions)) {
24+ if (
25+ !($ imageSource ->getOriginalImage () instanceof ImageWithDimensions)
26+ || !($ imageSource ->getOriginalImage () instanceof ProcessableImage)
27+ ) {
2428 return $ imageSource ;
2529 }
30+
31+ if (!$ imageSource ->getCroppedHeight () || !$ imageSource ->getCroppedWidth ()) {
32+ return $ imageSource ;
33+ }
34+
2635 if ($ this ->arguments ['height ' ] || $ this ->arguments ['width ' ]) {
2736 $ heightFactor = $ this ->arguments ['height ' ] ? $ this ->arguments ['height ' ] / $ imageSource ->getCroppedHeight () : 1 ;
2837 $ widthFactor = $ this ->arguments ['width ' ] ? $ this ->arguments ['width ' ] / $ imageSource ->getCroppedWidth () : 1 ;
You can’t perform that action at this time.
0 commit comments