nfp_sites/base/media/util.mjs
2022-08-02 08:00:57 +00:00

25 lines
No EOL
461 B
JavaScript

export function mediaToDatabase(media, removeFlag) {
if (media) {
return [
media.filename,
media.type,
media.path,
media.size,
media.preview.base64,
media.sizes.small.avif.path.replace(/_small\.avif$/, ''),
JSON.stringify(media.sizes),
removeFlag ? 1 : 0,
]
} else {
return [
null,
null,
null,
null,
null,
null,
null,
removeFlag ? 1 : 0,
]
}
}