[APP-2044] Gate image blob size increase (#10178)

This commit is contained in:
Eric Bailey
2026-04-09 14:06:25 -05:00
committed by GitHub
parent c42940b0ad
commit cfeac097e1
4 changed files with 9 additions and 1 deletions
+1
View File
@@ -10,6 +10,7 @@ export enum Features {
ImportContactsSettingsDisable = 'import_contacts:settings:disable',
LiveNowBetaDisable = 'live_now_beta:disable',
ImageUploadsHighResolution = 'image_uploads:high_resolution',
ImageUploadsBlobSize2mbEnabled = 'image_uploads:blob_size_2mb:enabled',
GroupChatsEnable = 'group_chats:enable',
DmsNewMessageComposerEnable = 'dms:new_message_composer:enable',
+2
View File
@@ -53,6 +53,7 @@ interface PostOpts {
type FeatureFlags = {
highResolutionImages?: boolean
increasedBlobSizeLimit?: boolean
}
export async function post(
@@ -320,6 +321,7 @@ async function resolveMedia(
logger.debug(`Compressing image #${i}`)
const {path, width, height, mime} = await compressImage(image, {
highResolution: featureFlags?.highResolutionImages,
increasedBlobSizeLimit: featureFlags?.increasedBlobSizeLimit,
})
logger.debug(`Uploading image #${i}`)
const res = await uploadBlob(agent, path, mime)
+3 -1
View File
@@ -204,6 +204,7 @@ export async function compressImage(
img: ComposerImage,
options?: {
highResolution?: boolean
increasedBlobSizeLimit?: boolean
},
): Promise<PickerImage> {
const source = img.transformed || img.source
@@ -211,6 +212,7 @@ export async function compressImage(
let attempts = 0
let maxDimension = highResolution ? 4000 : POST_IMG_MAX.width
let maxBytes = options?.increasedBlobSizeLimit ? 2000000 : POST_IMG_MAX.size
let minQualityPercentage = 0
let maxQualityPercentage = 101 // exclusive
@@ -251,7 +253,7 @@ export async function compressImage(
const base64 = res.base64
const size = base64 ? getDataUriSize(base64) : 0
if (base64 && size <= POST_IMG_MAX.size) {
if (base64 && size <= maxBytes) {
minQualityPercentage = qualityPercentage
newDataUri = {
path: await moveIfNecessary(res.uri),
+3
View File
@@ -838,6 +838,9 @@ export const ComposePost = ({
highResolutionImages: ax.features.enabled(
ax.features.ImageUploadsHighResolution,
),
increasedBlobSizeLimit: ax.features.enabled(
ax.features.ImageUploadsBlobSize2mbEnabled,
),
},
)
).uris[0]