From eee6b86e15c7e7cf3d136d89aacf1d672b88001a Mon Sep 17 00:00:00 2001 From: philipp lang Date: Tue, 13 Sep 2022 00:13:59 +0200 Subject: [PATCH] Delete temp when updating --- compressors/JpgCompressor.php | 2 ++ compressors/PngCompressor.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/compressors/JpgCompressor.php b/compressors/JpgCompressor.php index abceb24..5beb199 100644 --- a/compressors/JpgCompressor.php +++ b/compressors/JpgCompressor.php @@ -54,6 +54,8 @@ class JpgCompressor extends Compressor $versionFilename = $this->media->versionsDirPath().'/'.$this->versionFilename($destWidth, $destHeight); if ($update && Storage::exists($versionFilename)) { + Storage::delete($temp); + return; } diff --git a/compressors/PngCompressor.php b/compressors/PngCompressor.php index d2884f8..173ee51 100644 --- a/compressors/PngCompressor.php +++ b/compressors/PngCompressor.php @@ -64,6 +64,8 @@ class PngCompressor extends Compressor $versionFilename = $this->media->versionsDirPath().'/'.$this->versionFilename($destWidth, $destHeight); if ($update && Storage::exists($versionFilename)) { + Storage::delete($temp); + return; }