remote images disappear when calling exportHTML
HalimNaim opened this issue · 2 comments
We are hosting mosaico inside an iframe. When we images are uploaded, we upload them to s3 and return the s3 url to mosiaco. Images are uploaded and displayed correctly. After that, when we try to send the email, we call exportHTML
on the view model. This will cause the image displayed in the editor to "disappear". An error is printed to the console, from: https://github.com/voidlabs/mosaico/blob/master/src/js/app.js#L51 which I guess is reasonable. If we force the if condition above to be true, the images are displayed correctly:
if (true || backEndMatch === null || (srcMatch !== null && backEndMatch[1] == srcMatch[1])) {
Hope this is enough information.
We are using the version 0.17.5 installed from npm, with a backend inspired by the php backend linked to in the wiki.
I've reproduced this in chrome, edge and firefox on windows 10, and ubuntu.
Mosaico by default works with local images hosted on the same host providing image manipulation services (crop/resizing).
You can ovverride this behaviour by redefining the "ko.bindingHandlers.wysiwygSrc.convertedUrl" function. You can do that without changes to the mosaico library by defining your own plugin:
https://github.com/voidlabs/mosaico/wiki/Mosaico-Plugins
How you do that depends on how your backend deal with remote images manipulation.
Thank you for your response. Using a plugin is a good idea. I will try that. My other option was to serve the images from our backend so they are local.