HTML Purifier会删除图像样式,无论如何配置,如何允许它?

问题描述

我正在为Laravel使用https://github.com/mewebstudio/Purifier软件包,但遇到一个问题,无论我的配置如何,样式属性始终会从输入中删除。 这是我的配置

signIn

这是我的输入内容

        'HTML.Allowed'  => 'font[color|style],h1[class|style],h2[class|style],h3[class|style],h4[class|style],h5[class|style],div[class|style],b,strong,i,em,a[href|title|class|style],ul,ol,li,p[style|class],br,span[style|class],img[style|width|height|alt|src|class],table[style|class],tbody[style|class],thead[style|class],tr[style|class],td[style|class],th[style|class]','CSS.AllowedProperties'    => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width',

这就是我应用净化器的“干净”后得到的东西

<img src="http://mywebsite.deve/storage/1278/5f97ed8127418_5f8efd4d61487_image.png" class="img h-auto" style="width: 25%;" alt="" title="" role="">

我的配置错误吗?我已经在这个问题上停留了几个小时,非常感谢您的帮助。

解决方法

感谢这篇帖子https://github.com/mewebstudio/Purifier/issues/68,我终于设法使其正常运行。在配置中,只需在“ CSS.AllowedProperties” =>“ ...”下添加“ CSS.MaxImgLength” => null。