[ImageEncoder] Move DB::persist call to AttachmentThumbnail

This commit is contained in:
Hugo Sales 2021-04-16 22:55:00 +00:00
parent 0c8c5a4b87
commit d2bb5bba14
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 2 additions and 0 deletions

View File

@ -129,6 +129,8 @@ class AttachmentThumbnail extends Entity
$major_mime = GSFile::mimetypeMajor($attachment->getMimetype());
if (in_array($major_mime, array_keys($event_map))) {
Event::handle($event_map[$major_mime], [$attachment, $thumbnail, $width, $height, $crop]);
DB::persist($thumbnail);
DB::flush();
return $thumbnail;
} else {
Log::debug($m = ('Cannot resize attachment with mimetype ' . $attachment->getMimetype()));