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:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user