about summary refs log tree commit diff
path: root/src/lib/media/manip.ts
diff options
context:
space:
mode:
authorJaz <ericvolp12@gmail.com>2023-05-30 18:25:29 -0700
committerGitHub <noreply@github.com>2023-05-30 18:25:29 -0700
commit09ade363fdcfadb03433385e0c5510bc58438a65 (patch)
tree710af28d1eb7f70acf81f86acb44759439e164fc /src/lib/media/manip.ts
parent7f76c2d67e62ba2d10e8b17673a7bbcf7248564f (diff)
parente224569a11b82361d782324a63bdfc19d44a3201 (diff)
downloadvoidsky-09ade363fdcfadb03433385e0c5510bc58438a65.tar.zst
Merge branch 'main' into inherit_system_theme
Diffstat (limited to 'src/lib/media/manip.ts')
-rw-r--r--src/lib/media/manip.ts44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/lib/media/manip.ts b/src/lib/media/manip.ts
index 4491010e8..c35953703 100644
--- a/src/lib/media/manip.ts
+++ b/src/lib/media/manip.ts
@@ -6,52 +6,8 @@ import * as RNFS from 'react-native-fs'
 import uuid from 'react-native-uuid'
 import * as Sharing from 'expo-sharing'
 import {Dimensions} from './types'
-import {POST_IMG_MAX} from 'lib/constants'
 import {isAndroid, isIOS} from 'platform/detection'
 
-export async function compressAndResizeImageForPost(
-  image: Image,
-): Promise<Image> {
-  const uri = `file://${image.path}`
-  let resized: Omit<Image, 'mime'>
-
-  for (let i = 0; i < 9; i++) {
-    const quality = 100 - i * 10
-
-    try {
-      resized = await ImageResizer.createResizedImage(
-        uri,
-        POST_IMG_MAX.width,
-        POST_IMG_MAX.height,
-        'JPEG',
-        quality,
-        undefined,
-        undefined,
-        undefined,
-        {mode: 'cover'},
-      )
-    } catch (err) {
-      throw new Error(`Failed to resize: ${err}`)
-    }
-
-    if (resized.size < POST_IMG_MAX.size) {
-      const path = await moveToPermanentPath(resized.path)
-
-      return {
-        path,
-        mime: 'image/jpeg',
-        size: resized.size,
-        height: resized.height,
-        width: resized.width,
-      }
-    }
-  }
-
-  throw new Error(
-    `This image is too big! We couldn't compress it down to ${POST_IMG_MAX.size} bytes`,
-  )
-}
-
 export async function compressIfNeeded(
   img: Image,
   maxSize: number = 1000000,