Skip to content

Commit

Permalink
Fix for vips intervention image backend
Browse files Browse the repository at this point in the history
Remove the temporary file in Intervention image backend when resetting the image resource.
  • Loading branch information
forsdahl committed Aug 7, 2023
1 parent 5d88533 commit 2b915c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/InterventionBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function getAssetContainer()
*/
public function setAssetContainer($assetContainer)
{
$this->image = null;
$this->setImageResource(null);
$this->container = $assetContainer;
return $this;
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 2b915c5

Please sign in to comment.