How to configure HTML cleaner to resolve data URI for src image?

How can I resolve base64 data for src attribute for image tags? I see the following code:

$config->set('URI.AllowedSchemes', array('http' => true, 'https' => true, 'mailto' => true, 'ftp' => true, 'nntp' => true, 'news' => true, 'data' => true)); 

In this case, is data => true , which allows base64? And if so, how can I only allow base64 data for the src attribute of the img tag? (I do not want to allow data URIs in other situations.)

I was thinking of 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 it possible?

+7
php rich-text-editor htmlpurifier
source share
1 answer

Simple: only data only in your allowed schemes:

 $config->set('URI.AllowedSchemes', array('data' => true)); 
+15
source share

All Articles