Parameterize image max dimension and blob size

Replace the hardcoded POST_IMG_MAX limits baked into the resize helpers
with explicit per-caller maxDimension/maxBytes parameters. Pasted image
URLs now pre-shrink at the high-res 4000px/2MB post limits instead of
2000px/1MB, removing a quality bottleneck before compressImage runs.
Avatar/banner/onboarding and link thumbnails keep their 2000px/1MB
limits.

Also bring web doResize to parity with native by clamping dimensions via
a shared getResizedDimensions (hoisted into media/util.ts), and shadow
the mutated maxDimension param in compressImage as a local.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eric Bailey
2026-06-02 11:25:21 -05:00
parent 61e10f7e0b
commit e14d559a13
8 changed files with 97 additions and 74 deletions
+1 -3
View File
@@ -257,9 +257,7 @@ export async function imageToThumb(
try {
const img = await downloadAndResize({
uri: imageUri,
width: POST_IMG_MAX.width,
height: POST_IMG_MAX.height,
mode: 'contain',
maxDimension: POST_IMG_MAX.width,
maxSize: POST_IMG_MAX.size,
timeout: 15e3,
})