From 6f1361c14792ce6048daeb98df394a505153c74c Mon Sep 17 00:00:00 2001 From: gtlt <17992895+gtlt@users.noreply.github.com> Date: Tue, 30 Mar 2021 22:05:24 +0200 Subject: [PATCH] fallback to source image if it doesn't exists --- Convertor/Convertor.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Convertor/Convertor.php b/Convertor/Convertor.php index 7987f3e..2961170 100644 --- a/Convertor/Convertor.php +++ b/Convertor/Convertor.php @@ -126,6 +126,10 @@ public function convert(string $sourceImageUri, ?string $destinationImageUri = n $sourceImageFilename = $this->imageFile->resolve($sourceImageUri); $destinationImageFilename = $this->imageFile->resolve($destinationImageUri); + if(!$this->imageFile->fileExists($sourceImageFilename)) { + throw new ConvertorException('Source cached image does not exists ' . $sourceImageUri); + } + if (!$this->imageFile->needsConversion($sourceImageFilename, $destinationImageFilename)) { return true; }