From 7ebe7d79553ba75986325919529cbd5144663883 Mon Sep 17 00:00:00 2001 From: Jan Evers Date: Thu, 14 Nov 2024 15:42:04 +0100 Subject: [PATCH] feature(Felamimail): add support for png and gif images to select image --- .../library/ExtJS/src/widgets/form/HtmlEditor.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tine20/library/ExtJS/src/widgets/form/HtmlEditor.js b/tine20/library/ExtJS/src/widgets/form/HtmlEditor.js index b28b1ad6af..8970fdd8a6 100644 --- a/tine20/library/ExtJS/src/widgets/form/HtmlEditor.js +++ b/tine20/library/ExtJS/src/widgets/form/HtmlEditor.js @@ -1037,7 +1037,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { let img = new Image() img.src = result img.onload = () => { - this.imgOnload(img, target, max) + this.imgOnload(img, target, max, type) } }, @@ -1080,7 +1080,17 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { let reader = new FileReader() reader.readAsDataURL(fileBlob) reader.onload = () => { - this.getImageBase64(reader.result, button.size, this.selectedImage).then (() => { + let type = 'image/jpeg' + switch (this.selectedImage.alt.slice(-3)) { + case 'png': + type = 'image/png' + break; + case 'gif': + type = 'image/gif' + break; + } + + this.getImageBase64(reader.result, button.size, this.selectedImage, type).then (() => { this.selectedImage.dataset.size = button.size }) }