From f7e7e46c02d3590eb6b5bd149353d8b5e3ae167d Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 30 Oct 2021 23:08:27 +0200 Subject: [PATCH] Throw exception if resized image cannot be found before compression --- classes/ImageResizer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/ImageResizer.php b/classes/ImageResizer.php index 198af4d..2719b37 100644 --- a/classes/ImageResizer.php +++ b/classes/ImageResizer.php @@ -93,6 +93,9 @@ class ImageResizer } foreach ($this->file->versions() as $version) { + if (!$this->disk->exists($version->get('path'))) { + throw new ResizerException('File versions cannot be generated. Version file "'.$version->get('path').'" of "'.$this->file->root().'" doesnt exist.'); + } $this->file->compressor()->make($this->disk->path($version->get('path'))); } }