[ImageEncoder] Move DB::persist call to AttachmentThumbnail

This commit is contained in:
Hugo Sales 2021-04-16 22:55:00 +00:00 committed by Diogo Peralta Cordeiro
parent a33a25983e
commit c37a75cf7b

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()));