nl.gx.webmanager.taglib
Class SizedImageTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by nl.gx.webmanager.taglib.SizedImageTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

public class SizedImageTag
extends javax.servlet.jsp.tagext.SimpleTagSupport

Implements the wm:sizedImage tag. Resizes image objects. If the aspect ratio (height:width) of the resized image is different than the source image, the image will be cropped from the top and bottom or left and right to avoid getting black bars. Returns the resized image object.
Example of usage:

 < wm:image var="bullet" url=" http://www.gx.nl/images/bullet.jpg " />
 < wm:sizedImage var="bulletSmall" image="${bullet}" width="20" height="20" />
 ${bulletSmall.htmlTag}
 
In the example above the image stored in the variable "bullet" is resized to 20x20 pixels and returned in the variable "bulletSmall".


Constructor Summary
SizedImageTag()
           
 
Method Summary
 void doTag()
           
 void setHeight(java.lang.Integer height)
          Sets the height of the resized image in pixels.
 void setImage(Image image)
          Specifies the image object to resize.
 void setVar(java.lang.String var)
          Specifies the JSP variable to store the result in.
 void setWidth(java.lang.Integer width)
          Sets the width of the resized image in pixels.
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizedImageTag

public SizedImageTag()
Method Detail

setVar

public void setVar(java.lang.String var)
Specifies the JSP variable to store the result in.

Parameters:
var - a jsp variable name

setImage

public void setImage(Image image)
Specifies the image object to resize.

Parameters:
image - an image object

setWidth

public void setWidth(java.lang.Integer width)
Sets the width of the resized image in pixels.

Parameters:
width - in pixels

setHeight

public void setHeight(java.lang.Integer height)
Sets the height of the resized image in pixels.

Parameters:
height - in pixels

doTag

public void doTag()
           throws javax.servlet.jsp.JspException
Specified by:
doTag in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
Throws:
javax.servlet.jsp.JspException


Copyright © 2007-2011 GX Software BV. All Rights Reserved.