u
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { createHash } from 'node:crypto';
|
||||
import sharp from 'sharp';
|
||||
import generateDocumentThumb from '../../util/generateDocumentThumb.js';
|
||||
import {
|
||||
CREATE_FILE,
|
||||
CREATE_ATTACHMENT,
|
||||
@@ -142,19 +143,10 @@ export default function add(pool) {
|
||||
}
|
||||
|
||||
if (!thumbavif) {
|
||||
try {
|
||||
const thumbResult = await sharp(content)
|
||||
.resize(200, 200, { fit: 'inside', withoutEnlargement: true })
|
||||
.avif({ effort: 4 })
|
||||
.toBuffer({ resolveWithObject: true });
|
||||
thumbavif = thumbResult.data;
|
||||
thumbx = thumbResult.info.width;
|
||||
thumby = thumbResult.info.height;
|
||||
} catch {
|
||||
thumbavif = null;
|
||||
thumbx = null;
|
||||
thumby = null;
|
||||
}
|
||||
const generated = await generateDocumentThumb(content, mimetype);
|
||||
thumbavif = generated.thumbavif;
|
||||
thumbx = generated.thumbx;
|
||||
thumby = generated.thumby;
|
||||
}
|
||||
|
||||
const { companyId } = await access(googleAuthId);
|
||||
|
||||
Reference in New Issue
Block a user