How can I allow base64 data for the the src attribute of image tags? I see code like this:
$config->set('URI.AllowedSchemes', array('http' => true, 'https' => true, 'mailto' => true, 'ftp' => true, 'nntp' => true, 'news' => true, 'data' => true));
In this case, is it data => true
which allows the base64? And if so, how can I allow base64 data only for the src attribute of the img tag? (I do not want to allow data URIs in other situations.)
I thought of doing something like:
$ def-> addAttribute ('a', 'target', 'Enum # _blank, _self, _target, _top');
But in my case like this:
$ def-> addAtribute ('img', 'src', 'Enum # data, http, https, ...);
Is this possible?
Edward Z. Yang
Easy: just only have data
in your allowed schemes:
$config->set('URI.AllowedSchemes', array('data' => true));
来源:https://stackoverflow.com/questions/26524222/how-can-i-configure-html-purifier-to-allow-data-uris-for-image-src