redmine_ckeditor icon indicating copy to clipboard operation
redmine_ckeditor copied to clipboard

Image upload is broken in Email notification

Open chobong opened this issue 10 years ago • 3 comments

Hi

When i click "Browse and upload image" and insert image into issue description, the image is shown normally on web browser, but it's broken in notification email.

However, If I upload image by this function and then right click on this image, select "Image properties" and add my Redmine hostname before the URL in Image Info, it works.

I think the reason why image is broken because hostname of image's URL in email is mail server, not my Redmine.

Could you pls let me know how to set the hostname when insert image by Upload Image function?

Thank you.

chobong avatar Sep 08 '14 10:09 chobong

Hi chobong

Have you fix this issue?

ghost avatar Oct 20 '14 16:10 ghost

Hi, i have this same issue and fixed myself. Not the best way, but i included (hardcoded) the HOST URL (like http://localhost, or similar) when upload an image to Upload Image Browser. It worked on e-mails and still working on redmine too.

File: redmine_ckeditor/assets/ckeditor-contrib/plugins/richfile/plugin.js

editor._.insertImagefn = CKEDITOR.tools.addFunction(function(url, id, name){ this.insertHtml(''); }, editor);

Where getHost() is my function to load "http://localhost"

phoebusnetto avatar Aug 27 '15 20:08 phoebusnetto

So I found this old thread because I had the same problem.

It seems that the code in @phoebusnetto 's comment was garbled by Github's editor.

Here is how I solved this, in assets/ckeditor-contrib/plugins/richfile/plugin.js, edit the insertImagefn function to add the hostname like this :

            editor._.insertImagefn = CKEDITOR.tools.addFunction(function(url, id, name){
                                this.insertHtml('<img src="https://example.com/' + url + '" alt="" data-rich-file-id="' + id + '" />');
                        }, editor);

sylvainfaivre avatar May 17 '22 14:05 sylvainfaivre