refac
This commit is contained in:
@@ -380,7 +380,7 @@
|
||||
if (file['type'].startsWith('image/')) {
|
||||
const compressImageHandler = async (imageUrl, settings = {}, config = {}) => {
|
||||
// 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 configHeight = config?.file?.image_compression?.height ?? null;
|
||||
|
||||
@@ -420,9 +420,7 @@
|
||||
let imageUrl = event.target.result;
|
||||
|
||||
// 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 compressedFile = new File([blob], file.name, { type: file.type });
|
||||
|
||||
@@ -742,9 +742,7 @@
|
||||
let imageUrl = event.target.result;
|
||||
|
||||
// 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) {
|
||||
files = [
|
||||
|
||||
Reference in New Issue
Block a user