add image dimension detection for most common formats

This commit is contained in:
dswbx
2025-03-27 09:21:58 +01:00
parent f8f5ef9c98
commit 9407f3d212
10 changed files with 352 additions and 241 deletions

View File

@@ -75,13 +75,20 @@ export class AppMedia extends Module<typeof mediaConfigSchema> {
return this._storage!;
}
uploadedEventDataToMediaPayload(info: FileUploadedEventData) {
uploadedEventDataToMediaPayload(info: FileUploadedEventData): MediaFieldSchema {
const metadata: any = {};
if (info.meta.width && info.meta.height) {
metadata.width = info.meta.width;
metadata.height = info.meta.height;
}
return {
path: info.name,
mime_type: info.meta.type,
size: info.meta.size,
etag: info.etag,
modified_at: new Date(),
metadata,
};
}