From 47c497fb44ee487a4a6334c15d839afd5025b7c6 Mon Sep 17 00:00:00 2001 From: Patrick McLain Date: Thu, 11 Jan 2018 16:38:15 -0500 Subject: [PATCH] Log file path when image open throws exception --- lib/internal/Magento/Framework/Image/Adapter/Gd2.php | 5 ++++- lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php index 444ab7113d429..365fa5939b6b5 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php @@ -62,7 +62,10 @@ public function open($filename) throw new \OverflowException('Memory limit has been reached.'); } $this->imageDestroy(); - $this->_imageHandler = call_user_func($this->_getCallback('create'), $this->_fileName); + $this->_imageHandler = call_user_func( + $this->_getCallback('create', null, sprintf('Unsupported image format. File: %s', $this->_fileName)), + $this->_fileName + ); } /** diff --git a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php index 50b9a5a013273..e0ead031a9ba0 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php +++ b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php @@ -77,7 +77,7 @@ public function open($filename) try { $this->_imageHandler = new \Imagick($this->_fileName); } catch (\ImagickException $e) { - throw new \Exception('Unsupported image format.', $e->getCode(), $e); + throw new \Exception(sprintf('Unsupported image format. File: %s', $this->_fileName), $e->getCode(), $e); } $this->backgroundColor();