Files
hudozka/modules/hudozka-api/src/factory/image.ts
T
tmshv 877c63a874 api image refactoring
- standart image definition for old preview and new cover
2020-03-11 13:36:15 +03:00

23 lines
377 B
TypeScript

import Image from '../core/Image'
const ORIGINAL = 'original'
export type ImageDto = {
width: number
height: number
src: string
}
export function encodeImage(image: Image): ImageDto {
const a = image.getArtifact(ORIGINAL)
if (!image) {
return null
}
return {
src: a.url,
width: a.width,
height: a.height,
}
}