mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 21:06:04 +00:00
add image dimension detection for most common formats
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user