Hello,
I've installed wysiwyg image upload module 6.x-2.3 and it works as expected with TinyMCE.
However I'm not able to center images in text. I tried to create a new style in imgupload.css like

.imgupl_floating_none_center
{
display:block;
margin-left:auto;
margin-right:auto;
}

and modified wysiwyg_imageupload.form to show the style in alignment selection box.
In TinyMCE the image is then centered but when I save the work the image is left aligned again.

Is there a way to center images in articles?

Comments

eugenmayer’s picture

you might need to have a look at the theming for the "node view". Probably the styles having problems with the boxes we need to fix then. Just have a look with firebug / any css explorer and see why the image is not centered. in general your approach is perfectly right and should work out.

the difference between the WYSIWYG representation of the image is, that in the WYS.. its only

<img class="yourstyles"..>

while in the node view its surrounded by wrapper for meta data, capations etc. Thats where we could have issue.

Birgerkung’s picture

Status: Active » Closed (fixed)

Ok, figured it out.
I had to add:

text-align:center;

to the new style and now it works.
Thanks.

lazerus2000’s picture

Status: Closed (fixed) » Active

Got the same problem but adding text-align:center; doesn't solve it for me!

Code:

img.imgupl_styles_zentrieren
{
display:block;
margin-left:auto;
margin-right:auto;
text-align:center;
}

I'm using the st.alphorn theme and all Images are aligned left. Margin-left:60px works, but "auto" is doing nothing. Is there a solution? Why there is no "center image" CSS-class included?

Thanks for your help!

eugenmayer’s picture

Status: Active » Closed (fixed)

and that still stays fixed :)

lazerus2000’s picture

That was a great help! So it would have been better to create a new post with the same problem?