2022-07-27 08:41:18 +00:00
|
|
|
export function mediaToDatabase(media, removeFlag) {
|
|
|
|
if (media) {
|
|
|
|
return [
|
|
|
|
media.filename,
|
|
|
|
media.type,
|
|
|
|
media.path,
|
|
|
|
media.size,
|
2023-11-20 07:11:57 +00:00
|
|
|
media.preview?.base64 || null,
|
|
|
|
media.sizes?.small?.avif?.path?.replace(/_small\.avif$/, '') || null,
|
|
|
|
JSON.stringify(media.sizes || {}),
|
2022-07-27 08:41:18 +00:00
|
|
|
removeFlag ? 1 : 0,
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
return [
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
removeFlag ? 1 : 0,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|