api image update
This commit is contained in:
1 parent
ed1a924156
commit
8d67fbefd1
2 files changed
+26
-3
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import ImageArtifactType from '../core/ImageArtifactType'
|
||||
|
||||
export function encodeImage(image) {
|
||||
const artifacts = [
|
||||
ImageArtifactType.SMALL,
|
||||
ImageArtifactType.MEDIUM,
|
||||
ImageArtifactType.BIG,
|
||||
ImageArtifactType.LARGE,
|
||||
ImageArtifactType.ORIGIN,
|
||||
ImageArtifactType.ORIGINAL,
|
||||
ImageArtifactType.FACEBOOK = 'fb'
|
||||
].reduce((acc, size) => {
|
||||
return {
|
||||
...acc,
|
||||
[size]: image.getPicture(size),
|
||||
}
|
||||
}, {})
|
||||
|
||||
return {
|
||||
artifacts,
|
||||
hash: image.hash,
|
||||
file: image.file,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user