stevebauman/purify

Clears base64 images.

Closed this issue · 2 comments

This lib clears base64 images.

<img style="width: 268px;" src="data:image/png;base64 ...

This is strange, since it is mostly used to sanitize input from WYSIWYG and base64 images are mainstay of such editors. It should be an integral part of lib's core.

Hi @jeffz2012, this isn't a bug, this is purely configurable.

See: http://htmlpurifier.org/live/configdoc/plain.html#URI.AllowedSchemes

As well as: https://stackoverflow.com/questions/26524222/how-can-i-configure-html-purifier-to-allow-data-uris-for-image-src

Base 64 images could do a lot of unwanted things, so restricting it by default is (in my opinion) the correct route.

Also, just to reiterate, this package is simply a wrapper for HTMLPurifier.

for other people who are wondering how to enable base64 images in a laravel project, simply add this line:

'URI.AllowedSchemes' => 'data',

to the purify.php file inside the config folder