Apply per-use-case image size configs (#10690)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
import {useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {IMAGE_SIZE_CONFIG_2K_1MB} from '#/lib/constants'
|
||||
import {useHaptics} from '#/lib/haptics'
|
||||
import {
|
||||
useCameraPermission,
|
||||
@@ -395,6 +396,7 @@ let EditableUserAvatar = ({
|
||||
await openCamera({
|
||||
aspect: [1, 1],
|
||||
}),
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
}, [onSelectNewAvatar, requestCameraAccessIfNeeded])
|
||||
@@ -423,6 +425,7 @@ let EditableUserAvatar = ({
|
||||
shape: circular ? 'circle' : 'rectangle',
|
||||
aspectRatio: 1,
|
||||
}),
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
@@ -449,7 +452,7 @@ let EditableUserAvatar = ({
|
||||
|
||||
const onChangeEditImage = useCallback(
|
||||
async (image: ComposerImage) => {
|
||||
const compressed = await compressImage(image)
|
||||
const compressed = await compressImage(image, IMAGE_SIZE_CONFIG_2K_1MB)
|
||||
onSelectNewAvatar(compressed)
|
||||
},
|
||||
[onSelectNewAvatar],
|
||||
|
||||
@@ -6,6 +6,7 @@ import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
import {IMAGE_SIZE_CONFIG_2K_1MB} from '#/lib/constants'
|
||||
import {
|
||||
useCameraPermission,
|
||||
usePhotoLibraryPermission,
|
||||
@@ -62,6 +63,7 @@ export function UserBanner({
|
||||
await openCamera({
|
||||
aspect: [3, 1],
|
||||
}),
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
}, [onSelectNewBanner, requestCameraAccessIfNeeded])
|
||||
@@ -83,6 +85,7 @@ export function UserBanner({
|
||||
imageUri: items[0].path,
|
||||
aspectRatio: 3 / 1,
|
||||
}),
|
||||
IMAGE_SIZE_CONFIG_2K_1MB,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
@@ -108,7 +111,7 @@ export function UserBanner({
|
||||
|
||||
const onChangeEditImage = useCallback(
|
||||
async (image: ComposerImage) => {
|
||||
const compressed = await compressImage(image)
|
||||
const compressed = await compressImage(image, IMAGE_SIZE_CONFIG_2K_1MB)
|
||||
onSelectNewBanner?.(compressed)
|
||||
},
|
||||
[onSelectNewBanner],
|
||||
|
||||
Reference in New Issue
Block a user