[ENTITY] Cache AttachmentThumbnail query result

This commit is contained in:
Hugo Sales 2021-04-16 16:12:49 +00:00
parent 65999bd183
commit cdef6858ce
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 1 additions and 2 deletions

View File

@ -124,8 +124,7 @@ class AttachmentThumbnail extends Entity
return DB::findOneBy('attachment_thumbnail', ['attachment_id' => $attachment->getId(), 'width' => $width, 'height' => $height]);
});
} catch (NotFoundException $e) {
$thumbnail = self::create(['attachment_id' => $attachment->getId(), 'width' => $width, 'height' => $height, 'attachment' => $attachment]);
$thumbnail = self::create(['attachment_id' => $attachment->getId(), 'width' => $width, 'height' => $height, 'attachment' => $attachment]);
$event_map = ['image' => 'ResizeImage', 'video' => 'ResizeVideo'];
$major_mime = Media::mimetypeMajor($attachment->getMimetype());
if (in_array($major_mime, array_keys($event_map))) {