23 lines
377 B
TypeScript
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,
|
|
}
|
|
}
|