This commit is contained in:
Timothy Jaeryang Baek
2026-02-12 16:36:00 -06:00
parent 87d0c112fa
commit 5291b3dca2
2 changed files with 3 additions and 7 deletions
@@ -380,7 +380,7 @@
if (file['type'].startsWith('image/')) { if (file['type'].startsWith('image/')) {
const compressImageHandler = async (imageUrl, settings = {}, config = {}) => { const compressImageHandler = async (imageUrl, settings = {}, config = {}) => {
// Quick shortcut so we don’t do unnecessary work. // Quick shortcut so we don’t do unnecessary work.
const settingsCompression = settings?.imageCompression ?? false; const settingsCompression = (settings?.imageCompression && settings?.imageCompressionInChannels) ?? false;
const configWidth = config?.file?.image_compression?.width ?? null; const configWidth = config?.file?.image_compression?.width ?? null;
const configHeight = config?.file?.image_compression?.height ?? null; const configHeight = config?.file?.image_compression?.height ?? null;
@@ -420,9 +420,7 @@
let imageUrl = event.target.result; let imageUrl = event.target.result;
// Compress the image if settings or config require it // Compress the image if settings or config require it
if ($settings?.imageCompression && $settings?.imageCompressionInChannels) { imageUrl = await compressImageHandler(imageUrl, $settings, $config);
imageUrl = await compressImageHandler(imageUrl, $settings, $config);
}
const blob = await (await fetch(imageUrl)).blob(); const blob = await (await fetch(imageUrl)).blob();
const compressedFile = new File([blob], file.name, { type: file.type }); const compressedFile = new File([blob], file.name, { type: file.type });
+1 -3
View File
@@ -742,9 +742,7 @@
let imageUrl = event.target.result; let imageUrl = event.target.result;
// Compress the image if settings or config require it // Compress the image if settings or config require it
if ($settings?.imageCompression && $settings?.imageCompressionInChannels) { imageUrl = await compressImageHandler(imageUrl, $settings, $config);
imageUrl = await compressImageHandler(imageUrl, $settings, $config);
}
if ($temporaryChatEnabled) { if ($temporaryChatEnabled) {
files = [ files = [