I need to configure the filter so that it respects all attributes of an image added via IMCE. I've tried everything I can think of but I still cannot get the image to display correctly.

With filtering turned off, the html is:

<img alt="Modified Endowment Contract" src="http://xxx.xxx.xxx.xxx/sites/default/files/internal-revenue-code.jpg" style="border-width: 0px; border-style: solid; width: 240px; height: 175px; float: right;" />

With filtering turned off with my current settings, the html is:

<img alt="Modified Endowment Contract" src="http://xxx.xxx.xxx.xxx/sites/default/files/internal-revenue-code.jpg" />

So the style is being stripped out completely.

In the settings, I have the following HTML elements and attributes:

a[!href|target<_blank|title],
div[align<center?justify?left?right],
p[align<center?justify?left?right],
img[!src|alt|title|style|width|height|class|typeof],
br,span,em,strong,cite,code,blockquote,ul,ol,li,dl,dt,dd

I have every checkbox checked just to make sure. For Rules for Class Names I'm just using "userclass*". Nothing for Rules for Element IDs. And for Rules for URLs used within inline styles I'm using: /*,/~site/*,http://xxx.xxx.xxx.xxx/*.

What am I doing wrong?

Thanks

Comments

Lloyd’s picture

anybody?

Kristen Pol’s picture

I'm getting this same problem with TinyMCE+wysiwyg filter. Turn off wysiwyg filter and everything is aligned properly. Turn on wysiwyg filter and styles are stripped out.

I'm using Media module (2.x branch). I thought maybe it was due to that. Are you using the Media module for image insertion?

My filtering is set up with:

a[!href|target<_blank|title|style],
        div[style|align<center?justify?left?right],
        br,em,i,strong,cite,code,blockquote,ul,ol,li,dl,dt,dd,
        span[style],p[style],
        h1,h2,h3,h4,h5,h6,
        img[!src|title|alt|style|width|height|class],
        @[style]

When using the default filters, then I couldn't even see the images within the wysiwyg. When changing the filters to above, then I could see them in the wysiwyg but then the image styles are removed so the alignment is not as desired when viewing.

populist’s picture

In order to get image alignment working correctly, you not only need to set up the filtering rules as you did above (i.e. allow the img tag with the style property) but ALSO check the "float" option in the allowed styles further down on the configuration page.

Kristen Pol’s picture

Thanks @populist. That is the solution provided here too:

#1602280: Images added using Media Browser in TinyMCE do not keep alignment due to WYSIWYG Filter

so I'll try it!

populist’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.