From 51f0ad7497bde042627389d7c7ff085b90721969 Mon Sep 17 00:00:00 2001 From: James Collins Date: Mon, 24 Apr 2023 09:53:47 +1000 Subject: [PATCH] only add variant if created --- app/Jobs/StoreUploadedFileJob.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Jobs/StoreUploadedFileJob.php b/app/Jobs/StoreUploadedFileJob.php index 10591f4..df6cc26 100644 --- a/app/Jobs/StoreUploadedFileJob.php +++ b/app/Jobs/StoreUploadedFileJob.php @@ -131,13 +131,11 @@ class StoreUploadedFileJob implements ShouldQueue $newFilename = pathinfo($this->media->name, PATHINFO_FILENAME) . "-$postfix." . pathinfo($this->media->name, PATHINFO_EXTENSION); - // Store the variant in the variants array - $variants[$variantName] = $newFilename; - if (Storage::disk($storageDisk)->exists($newFilename) == false || $this->replaceExisting == true) { // Get the largest available variant if ($dimensions[0] >= $size[0] && $dimensions[1] >= $size[1]) { - // $largestVariant = $newFilename; + // Store the variant in the variants array + $variants[$variantName] = $newFilename; // Resize the image to the variant size if its dimensions are greater than the specified size $image = clone $originalImage;