|Title|Centering images using Image-Plugin does not work in Firefox
|Date|21-Nov-2005 15:21:28 EET
|Version|2.2.33, 2.4.2-cvs
|[Bug criticality]|LightBug
|Browser version|Firefox 1.0.7, Firefox, Konqueror 3.5.2
|[Bug status]|ClosedBug
|[PageProvider] used|VersioningFileProvider
|Servlet Container|
|Operating System|Gentoo Linux, Microsoft Windows XP SP2
|URL|[The JSP Wiki Testpage|Test]
|Java version|1.4.2-02

I normally use the Image-Plugin to make JSPWiki show a picture centered. However, in Firefox or Konqueror the image is still aligned left. When using {{align=right}}, the image is displayed correctly.
This does not affect Opera or Internet Explorer, though.

!!!Expected behavior
When using {{align=center}}, the image should be centered correctly in any browser.

!!!How to reproduce
* Start a new article
* Embed an image using the Image-Plugin
* Use the attribute {{align=center}} to make the image shown centered
* Save the article
* Open the article in either Firefox or Konqueror
* The image is not centered but aligned to the left




I don't wish to rush anyone, but I would very much like to see this bug fixed :)

--Andreas Janda, 04-Apr-2006



Workaround fix I guess?

its a pretty ugly and counter-intuitive fix

Image.java (found in the source code src/com/ecyrd/jspwiki/plugin)

if( align != null ) result.append(" align=\""+align+"\"");
if( style != null ) result.append(" style=\""+style+"\"");

changed to:

if( style != null ) 
   result.append(" style=\""+style);
   if( align != null && align.equals("center") ) 
      result.append(" margin-left: auto; margin-right: auto;");
if( style == null && align.equals("center") ) result.append(" style=\"margin-left: auto; margin-right: auto;\"");
if( align != null && !(align.equals("center")) ) result.append(" align=\""+align+"\"");

Again, sorry if the code is bad and counter-intuitive, just threw it together real quick. I"m sure theres a better, but yeah just pointing out where to fix this problem

--Alex Reid, 13-Jul-2006


Fixed in 2.4.31.