Skip to content

Commit ce05b97

Browse files
Chhandak.BaruaChhandak.Barua
Chhandak.Barua
authored and
Chhandak.Barua
committed
ACP2E-3127: imagecreatetruecolor(): Argument #2 () must be greater than 0. Can't upload specific image
1 parent 29fe909 commit ce05b97

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,14 @@ public function resizeFile($source, $keepRatio = true)
722722
$image->keepAspectRatio($keepRatio);
723723

724724
[$imageWidth, $imageHeight] = $this->getResizedParams($source);
725-
725+
try {
726+
$image->resize($imageWidth, $imageHeight);
727+
}
728+
catch (\Throwable $e)
729+
{
730+
$this->logger->critical( 'FAILED WYSIWYG IMAGE RESIZING: ' . ' error: ' . $e->getMessage() . '. path: ' . $realPath );
731+
return false;
732+
}
726733
$image->resize($imageWidth, $imageHeight);
727734
$dest = $targetDir . '/' . $this->ioFile->getPathInfo($source)['basename'];
728735
$image->save($dest);

0 commit comments

Comments
 (0)