TitleCentering images using Image-Plugin does not work in Firefox
Date21-Nov-2005 15:21:28 EET
Version2.2.33, 2.4.2-cvs
SubmitterAndreasJanda
Bug criticalityLightBug
Browser versionFirefox 1.0.7, Firefox 1.5.0.2, Konqueror 3.5.2
Bug statusClosedBug
PageProvider usedVersioningFileProvider
Servlet Container
Operating SystemGentoo Linux, Microsoft Windows XP SP2
URLThe JSP Wiki Testpage
Java version1.4.2-02

Description#

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

Confirmed.


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;");
   }
		
   result.append("\"");
}
	
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.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-12) was last changed on 05-Aug-2006 14:15 by Janne Jalkanen