deer social fork for personal usage. but you might see a use idk. github mirror

WEBP ON ANDROID FINALLY WORKS!!

aylac.top 053d6f92 cfec8f1b

verified
Changed files
+5 -4
src
state
+5 -4
src/state/gallery.ts
··· 1 + import {getFileSize} from 'react-native-compressor' 1 2 import * as WebP from 'react-native-webp-converter' 2 3 import { 3 4 cacheDirectory, ··· 193 194 webp: boolean = true, 194 195 ): Promise<PickerImage> { 195 196 const source = img.transformed || img.source 196 - const originalSize = getDataUriSize(img.source.path) 197 + const originalSize = (await getFileSize(source.path)) as unknown as number 197 198 198 199 const [w, h] = containImageRes(source.width, source.height, POST_IMG_MAX) 199 200 ··· 212 213 213 214 const format = webp 214 215 ? SaveFormat.WEBP 215 - : qualityPercentage 216 + : qualityPercentage === 100 216 217 ? SaveFormat.PNG 217 218 : SaveFormat.JPEG 218 219 ··· 262 263 quality: saveOptions.compress || 100, 263 264 }) 264 265 265 - const blob = await (await fetch(resultUri)).blob() 266 + const size = (await getFileSize(resultUri)) as unknown as number 266 267 267 268 return { 268 269 uri: resultUri, 269 - size: blob.size, 270 + size, 270 271 } 271 272 } 272 273