Skip to content

Commit

Permalink
Merge pull request #60 from dmitriymikheev/auto-delete-image-condition
Browse files Browse the repository at this point in the history
Fixed an error when deleting a record
  • Loading branch information
saqueib committed May 10, 2022
2 parents da1bb0b + 63df868 commit f0b0af1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/HasImageUploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,9 @@ protected function autoDeleteImage(): void
if (config('imageup.auto_delete_images')) {
foreach ($this->getDefinedUploadFields() as $field => $options) {
$field = is_numeric($field) ? $options : $field;
$this->deleteImage($this->getOriginal($field));
if (!is_null($this->getOriginal($field))) {
$this->deleteImage($this->getOriginal($field));
}
}
}
}
Expand Down

0 comments on commit f0b0af1

Please sign in to comment.