about summary refs log tree commit diff
path: root/src/lib/api/index.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-09-27 09:08:21 -0700
committerGitHub <noreply@github.com>2023-09-27 09:08:21 -0700
commitd87c232660f215608c26280f4cfbd5af3948f9d1 (patch)
treefc5ac5782e48128650293d92e83ae41b8c4a9c03 /src/lib/api/index.ts
parent6325eff938495b88a3808aef3c772e9fe93d5550 (diff)
downloadvoidsky-d87c232660f215608c26280f4cfbd5af3948f9d1.tar.zst
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)
Diffstat (limited to 'src/lib/api/index.ts')
-rw-r--r--src/lib/api/index.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts
index 4ecd32046..8a9389a18 100644
--- a/src/lib/api/index.ts
+++ b/src/lib/api/index.ts
@@ -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},
       })
     }