Improve image cropping on android and introduce aspect ratio field (#1525)

* Fix image cropping on android

* Store and use aspect ratio field in post images (close #1392)
This commit is contained in:
Paul Frazee 2023-09-27 09:08:21 -07:00 committed by GitHub
parent 6325eff938
commit d87c232660
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 7 deletions

View file

@ -133,10 +133,12 @@ export async function post(store: RootStoreModel, opts: PostOpts) {
opts.onStateChange?.(`Uploading image #${images.length + 1}...`)
await image.compress()
const path = image.compressed?.path ?? image.path
const {width, height} = image.compressed || image
const res = await uploadBlob(store, path, 'image/jpeg')
images.push({
image: res.data.blob,
alt: image.altText ?? '',
aspectRatio: {width, height},
})
}