Is there a way to prevent saving of base64 images in the rich text editor? Sometimes editors will (presumably) just paste an image into the RTE, and this results in <img src="data:image/png;base64... in the resulting HTML and ultimately triggers this issue.
Is there some way I can block base64 saving to prevent this from happening in the future?
I don't believe that is what happens when you paste in an image, definitely not on my U10 instance, when you first paste in an image this gets written to the RTE <img src="blob:https://localhost:44316/92bab7d7-90f6-40b5-a173-501f4210e57a" alt="" width="364" height="261" data-tmpimg="~\umbraco\Data\TEMP\FileUploads\rte\56f2a9ab-cc2a-46f8-a2e4-7f589080b7f8\image.png" /> when you then save it would seem it gets uploaded to media as <img src="/media/bbcpn4nz/image.png?rmode=max&width=364&height=261" alt="" width="364" height="261" data-udi="umb://media/f9e6450e7fb944318a873d16bf69a4ba" />
OK, maybe the editors are doing something else, or there's a strange incompatibility here. However, base64-encoded data is still appearing in the HTML. I'm not really worried about how it originally gets in there, as long as it can't be saved.
Can something be done in the TinyMCE configuration to prevent this?
You would probably need to create a notification handler when saving and then maybe use some regex to strip out image tags with base64 in the src attribute
I've found someone else with the same issue and there's a comment on there that "Tiny MCE 4.x has a new option to prevent data URIs." That would be much easier than writing a custom handler/regex, but unfortunately there's no further detail on where to find this feature.
It appears that it might be paste data images. However, I've yet to replicate the base64 behaviour myself, and the "offending" editor seems to have been out of the office all week, so I haven't been able to actually test this.
In short, I'm not ignoring you, but just don't really have anything else to say yet.
Block base64 in RTE?
Hi everyone,
Is there a way to prevent saving of base64 images in the rich text editor? Sometimes editors will (presumably) just paste an image into the RTE, and this results in
<img src="data:image/png;base64...
in the resulting HTML and ultimately triggers this issue.Is there some way I can block base64 saving to prevent this from happening in the future?
I'm running Umbraco 10.6.1.
I don't believe that is what happens when you paste in an image, definitely not on my U10 instance, when you first paste in an image this gets written to the RTE
<img src="blob:https://localhost:44316/92bab7d7-90f6-40b5-a173-501f4210e57a" alt="" width="364" height="261" data-tmpimg="~\umbraco\Data\TEMP\FileUploads\rte\56f2a9ab-cc2a-46f8-a2e4-7f589080b7f8\image.png" />
when you then save it would seem it gets uploaded to media as<img src="/media/bbcpn4nz/image.png?rmode=max&width=364&height=261" alt="" width="364" height="261" data-udi="umb://media/f9e6450e7fb944318a873d16bf69a4ba" />
OK, maybe the editors are doing something else, or there's a strange incompatibility here. However, base64-encoded data is still appearing in the HTML. I'm not really worried about how it originally gets in there, as long as it can't be saved.
Can something be done in the TinyMCE configuration to prevent this?
You would probably need to create a notification handler when saving and then maybe use some regex to strip out image tags with base64 in the src attribute
I've found someone else with the same issue and there's a comment on there that "Tiny MCE 4.x has a new option to prevent data URIs." That would be much easier than writing a custom handler/regex, but unfortunately there's no further detail on where to find this feature.
It appears that it might be paste data images. However, I've yet to replicate the base64 behaviour myself, and the "offending" editor seems to have been out of the office all week, so I haven't been able to actually test this.
In short, I'm not ignoring you, but just don't really have anything else to say yet.
is working on a reply...