Skip to content

Commit 58f7f60

Browse files
committed
ACP2E-2970: Old media gallery fails to render images when a 0-byte image is placed in the directory
1 parent 8ae45e9 commit 58f7f60

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -423,22 +423,13 @@ public function getFilesCollection($path, $type = null)
423423
}
424424

425425
try {
426-
if ($item->getSize() > 0) {
427-
$size = getimagesizefromstring(
428-
$driver->fileGetContents($item->getFilename())
429-
);
430-
431-
if (is_array($size)) {
432-
$item->setWidth($size[0]);
433-
$item->setHeight($size[1]);
434-
}
435-
} else {
436-
$this->logger->notice(
437-
sprintf(
438-
"The image file %s cannot be processed by the Gallery because it has an invalid size.",
439-
$item->getFilename()
440-
)
441-
);
426+
$size = getimagesizefromstring(
427+
$driver->fileGetContents($item->getFilename())
428+
);
429+
430+
if (is_array($size)) {
431+
$item->setWidth($size[0]);
432+
$item->setHeight($size[1]);
442433
}
443434
} catch (\Error $e) {
444435
$this->logger->notice(sprintf("GetImageSize caused error: %s", $e->getMessage()));

0 commit comments

Comments
 (0)