File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
app/code/Magento/Cms/Model/Wysiwyg/Images Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -628,13 +628,22 @@ public function resizeFile($source, $keepRatio = true)
628
628
}
629
629
$ image = $ this ->_imageFactory ->create ();
630
630
$ image ->open ($ source );
631
+
631
632
$ image ->keepAspectRatio ($ keepRatio );
632
- list ($ imageWidth , $ imageHeight ) = getimagesize ($ source );
633
+
634
+ list ($ imageWidth , $ imageHeight ) = @getimagesize ($ source );
633
635
634
- $ image ->resize (
635
- $ this ->_resizeParameters ['width ' ] > $ imageWidth ? $ imageWidth : $ this ->_resizeParameters ['width ' ],
636
- $ this ->_resizeParameters ['height ' ] > $ imageHeight ? $ imageHeight : $ this ->_resizeParameters ['height ' ]
637
- );
636
+ if ($ imageWidth && $ imageHeight ) {
637
+ $ configWidth = $ this ->_resizeParameters ['width ' ];
638
+ $ configHeight = $ this ->_resizeParameters ['height ' ];
639
+ $ imageWidth = $ configWidth > $ imageWidth ? $ imageWidth : $ this ->_resizeParameters ['width ' ];
640
+ $ imageHeight = $ configHeight > $ imageHeight ? $ imageHeight : $ this ->_resizeParameters ['height ' ];
641
+ } else {
642
+ $ imageWidth = $ this ->_resizeParameters ['width ' ];
643
+ $ imageHeight = $ this ->_resizeParameters ['height ' ];
644
+ }
645
+
646
+ $ image ->resize ($ imageWidth , $ imageHeight );
638
647
$ dest = $ targetDir . '/ ' . $ this ->ioFile ->getPathInfo ($ source )['basename ' ];
639
648
$ image ->save ($ dest );
640
649
if ($ this ->_directory ->isFile ($ this ->_directory ->getRelativePath ($ dest ))) {
You can’t perform that action at this time.
0 commit comments