stevebauman / purify

A Laravel wrapper for HTMLPurifier by ezyang
MIT License
447 stars 35 forks source link

Image style attributes stripped #74

Closed 06tech closed 1 year ago

06tech commented 1 year ago

Image tags are having their style attributes removed - the style tags are added by an RTE so I have no control over how the markup is generated.

Example is:- <img src="..." style="width: 50%;"> -> <img src="...">

My config is as follows:-

HTML.Allowed' => 'h1,h2,h3,h4,h5,h6,b,strong,i[class|id],em,a[href|title|class|id|style],ul,ol,li,p[style|class],br,span[style|class|id],img[width|height|alt|src|class|style],div[style|class|id]',

'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,padding-right,padding-top,padding-bottom,padding,color,background-color,text-align,background,width,height',

I thought it could be the config cache so I ran:-

php artisan purify:clear but that produced the error There are no commands defined in the "purify" namespace.

Any ideas? Thanks

stevebauman commented 1 year ago

Hi @06tech!

Please create an issue on the core HTML Purifier repository, as Purify simply wraps this library:

https://github.com/ezyang/htmlpurifier