Class CmsJspTagImage

java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.opencms.jsp.CmsJspImageScalerTagSupport
org.opencms.jsp.CmsJspTagImage
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, I_CmsJspTagParamParent

Creates HTML code for <img src> tags that use the OpenCms image scaling capabilities.

Since:
6.2.0
See Also:
  • Constructor Details

    • CmsJspTagImage

      public CmsJspTagImage()
      Creates a new image scaling tag instance.

  • Method Details

    • getScaler

      public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam)
      Creates the images scaler used by this image tag.

      Parameters:
      scaler - the scaler created from this tags parameters
      original - a scaler that contains the original image dimensions
      scaleParam - optional scaler parameters for cropping
      Returns:
      the images scaler used by this image tag
    • imageTagAction

      public static String imageTagAction(String src, CmsImageScaler scaler, Map<String,String> attributes, boolean partialTag, boolean noDim, javax.servlet.ServletRequest req) throws CmsException
      Internal action method to create the tag content.

      Parameters:
      src - the image source
      scaler - the image scaleing parameters
      attributes - the additional image HTML attributes
      partialTag - if true, the opening <img and closing /> is omitted
      noDim - if true, the height and width attributes are omitted
      req - the current request
      Returns:
      the created <img src> tag content
      Throws:
      CmsException - in case something goes wrong
    • imageTagAction

      public static String imageTagAction(String src, CmsImageScaler scaler, Map<String,String> attributes, boolean partialTag, javax.servlet.ServletRequest req) throws CmsException
      Internal action method to create the tag content.

      Parameters:
      src - the image source
      scaler - the image scaleing parameters
      attributes - the additional image HTML attributes
      partialTag - if true, the opening <img and closing /> is omitted
      req - the current request
      Returns:
      the created <img src> tag content
      Throws:
      CmsException - in case something goes wrong
    • addParameter

      public void addParameter(String name, String value)
      Description copied from interface: I_CmsJspTagParamParent
      Add a parameter to this tag. The intent is that the <param> subtag will call this to register parameters. Assumes that 'name' and 'value' are appropriately encoded and do not contain any meaningful metacharacters; in order words, escaping is the responsibility of the caller.
      Specified by:
      addParameter in interface I_CmsJspTagParamParent
      Parameters:
      name - the name of the parameter
      value - the value of the parameter
      See Also:
    • doEndTag

      public int doEndTag() throws javax.servlet.jsp.JspException
      Specified by:
      doEndTag in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
      Throws:
      javax.servlet.jsp.JspException
      See Also:
      • Tag.doEndTag()
    • doStartTag

      public int doStartTag()
      Returns BodyTag.EVAL_BODY_BUFFERED.

      Specified by:
      doStartTag in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
      Returns:
      BodyTag.EVAL_BODY_BUFFERED
      See Also:
      • Tag.doStartTag()
    • getAlign

      public String getAlign()
      Returns the value of the HTML "align" attribute.

      Returns:
      the value of the HTML "align" attribute
    • getAlt

      public String getAlt()
      Returns the value of the HTML "alt" attribute.

      Returns:
      the value of the HTML "alt" attribute
    • getBorder

      public String getBorder()
      Returns the value of the HTML "border" attribute.

      Returns:
      the value of the HTML "border" attribute
    • getCssclass

      public String getCssclass()
      Returns the value of the HTML "class" attribute.

      Returns:
      the value of the HTML "class" attribute
    • getHspace

      public String getHspace()
      Returns the value of the HTML "hspace" attribute.

      Returns:
      the value of the HTML "hspace" attribute
    • getId

      public String getId()
      Returns the value of the HTML "id" attribute.

      Overrides:
      getId in class javax.servlet.jsp.tagext.TagSupport
      Returns:
      the value of the HTML "id" attribute
    • getLongdesc

      public String getLongdesc()
      Returns the value of the HTML "longdesc" attribute.

      Returns:
      the value of the HTML "longdesc" attribute
    • getName

      public String getName()
      Returns the value of the HTML "name" attribute.

      Returns:
      the value of the HTML "name" attribute
    • getNoDim

      public String getNoDim()
      Returns "true" if the created HTML image tag does not contain height and width attributes.

      Returns:
      "true" if the created HTML image tag does not contain height and width attributes
    • getStyle

      public String getStyle()
      Returns the value of the HTML "style" attribute.

      Returns:
      the value of the HTML "style" attribute
    • getTitle

      public String getTitle()
      Returns the value of the HTML "title" attribute.

      Returns:
      the value of the HTML "title" attribute
    • getUsemap

      public String getUsemap()
      Returns the value of the HTML "usemap" attribute.

      Returns:
      the value of the HTML "usemap" attribute
    • getVspace

      public String getVspace()
      Returns the value of the HTML "vspace" attribute.

      Returns:
      the value of the HTML "vspace" attribute
    • isPartialTag

      public String isPartialTag()
      Returns "true" if the HTML tag should only be created as partial tag.

      Returns:
      "true" if the HTML tag should only be created as partial tag
    • release

      public void release()
      Description copied from class: CmsJspImageScalerTagSupport
      Does some cleanup and creates a new ImageScaler before the tag is released to the tag pool.
      Specified by:
      release in interface javax.servlet.jsp.tagext.Tag
      Overrides:
      release in class CmsJspImageScalerTagSupport
      See Also:
      • Tag.release()
    • setAlign

      public void setAlign(String value)
      Sets the value of the HTML "align" attribute.

      Parameters:
      value - the value of the HTML "align" attribute to set
    • setAlt

      public void setAlt(String value)
      Sets the value of the HTML "alt" attribute.

      Parameters:
      value - the value of the HTML "alt" attribute to set
    • setBorder

      public void setBorder(String value)
      Sets the value of the HTML "border" attribute.

      Parameters:
      value - the value of the HTML "border" attribute to set
    • setCssclass

      public void setCssclass(String value)
      Sets the value of the HTML "class" attribute.

      Parameters:
      value - the value of the HTML "class" attribute to set
    • setHspace

      public void setHspace(String value)
      Sets the value of the HTML "hspace" attribute.

      Parameters:
      value - the value of the HTML "hspace" attribute to set
    • setId

      public void setId(String value)
      Sets the value of the HTML "id" attribute.

      Overrides:
      setId in class javax.servlet.jsp.tagext.TagSupport
      Parameters:
      value - the value of the HTML "id" attribute to set
    • setLongdesc

      public void setLongdesc(String value)
      Sets the value of the HTML "longdesc" attribute.

      Parameters:
      value - the value of the HTML "longdesc" attribute to set
    • setName

      public void setName(String value)
      Sets the value of the HTML "name" attribute.

      Parameters:
      value - the value of the HTML "name" attribute to set
    • setNoDim

      public void setNoDim(String noDim)
      Controls if the created HTML image tag contains height and width attributes.

      Parameters:
      noDim - the value to set
    • setPartialTag

      public void setPartialTag(String partialTag)
      Controls if the created HTML image tag is a full or partial tag.

      Parameters:
      partialTag - the value to set
    • setStyle

      public void setStyle(String value)
      Sets the value of the HTML "style" attribute.

      Parameters:
      value - the value of the HTML "style" attribute to set
    • setTitle

      public void setTitle(String value)
      Sets the value of the HTML "title" attribute.

      Parameters:
      value - the value of the HTML "title" attribute to set
    • setUsemap

      public void setUsemap(String value)
      Sets the value of the HTML "usemap" attribute.

      Parameters:
      value - the value of the HTML "usemap" attribute to set
    • setVspace

      public void setVspace(String value)
      Sets the value of the HTML "vspace" attribute.

      Parameters:
      value - the value of the HTML "vspace" attribute to set