From 2b915c5cb820d4135a3470a4b8bc510289400d6b Mon Sep 17 00:00:00 2001 From: Niklas Forsdahl Date: Fri, 4 Aug 2023 15:30:26 +0300 Subject: [PATCH] Fix for vips intervention image backend Remove the temporary file in Intervention image backend when resetting the image resource. --- src/InterventionBackend.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/InterventionBackend.php b/src/InterventionBackend.php index b47bc4fd..cc5f4958 100644 --- a/src/InterventionBackend.php +++ b/src/InterventionBackend.php @@ -172,7 +172,7 @@ public function getAssetContainer() */ public function setAssetContainer($assetContainer) { - $this->image = null; + $this->setImageResource(null); $this->container = $assetContainer; return $this; } @@ -337,6 +337,12 @@ public function loadFrom($path) public function setImageResource($image) { $this->image = $image; + if ($image === null) { + // remove our temp file if it exists + if (file_exists($this->getTempPath() ?? '')) { + unlink($this->getTempPath() ?? ''); + } + } return $this; }