about summary refs log tree commit diff
path: root/src/lib/media/manip.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-03-21 12:59:10 -0500
committerGitHub <noreply@github.com>2023-03-21 12:59:10 -0500
commit858d4c8c8811ca8e16bffe3bfe0d541e576177ec (patch)
tree8199e1029edb7161c34fb59806399c30fcdd61a3 /src/lib/media/manip.ts
parentc1d454b7cfe6a7ec107b39483df9cb0fb64e1c76 (diff)
downloadvoidsky-858d4c8c8811ca8e16bffe3bfe0d541e576177ec.tar.zst
Introduce an image sizes cache to improve feed layouts (close #213) (#335)
* Introduce an image sizes cache to improve feed layouts (close #213)

* Clear out resolved promises from the image cache
Diffstat (limited to 'src/lib/media/manip.ts')
-rw-r--r--src/lib/media/manip.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/media/manip.ts b/src/lib/media/manip.ts
index e44ee3907..6ff8b691c 100644
--- a/src/lib/media/manip.ts
+++ b/src/lib/media/manip.ts
@@ -5,6 +5,11 @@ import RNFS from 'react-native-fs'
 import uuid from 'react-native-uuid'
 import * as Toast from 'view/com/util/Toast'
 
+export interface Dim {
+  width: number
+  height: number
+}
+
 export interface DownloadAndResizeOpts {
   uri: string
   width: number
@@ -119,10 +124,6 @@ export async function compressIfNeeded(
   return finalImg
 }
 
-export interface Dim {
-  width: number
-  height: number
-}
 export function scaleDownDimensions(dim: Dim, max: Dim): Dim {
   if (dim.width < max.width && dim.height < max.height) {
     return dim