OpenCms JSP standard taglib
Tag img


This tag allows using the OpenCms native image scaling mechanism. It generates the HTML required to include the selected image, adding the required image scaling parameters.

The following image formats are supported: BMP, GIF, JPEG, PNG, PNM, TIFF. Note: Picture scaling is by default only enabled for target size with width and height <=1500. The size can be changed in the image scaler configuration in the file opencms-vfs.xml in the body of the tag <loader>. Also other options for the image scaler are set there.


Tag Information
Tag Classorg.opencms.jsp.CmsJspTagImage
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

Attributes
NameRequiredRequest-timeTypeDescription
srcfalsetruejava.lang.StringURI of the image's source file.

Note: The uri will be adjusted by OpenCms automatically, so do not use <cms:link>.
widthfalsetruejava.lang.StringA natural number specifying the target width, i.e., the value of the width attribute set in the generated HTML <img> tag.
heightfalsetruejava.lang.StringA natural number specifying the target height, i.e., the value of the height attribute set in the generated HTML <img> tag.
maxWidthfalsetruejava.lang.StringDeprecated

A natural number specifying the maximal width of an image scaled with scaleType="5".
For other scale types the attribute is ignored.
maxHeightfalsetruejava.lang.StringDeprecated

A natural number specifying the maximal height of an image scaled with scaleType="5".
For other scale types the attribute is ignored.
scaleTypefalsetruejava.lang.StringSet the scale type used for the image.
The following values are supported:
0 (default)
Scale to exact target size with background padding:
The image is scaled (enlarged or shrinked) to fit completely into the given target size (height/width) without changing aspect ratio. If attributes height and width are both specified, potentially arising space is filled up in the color defined via the attribute scaleColor.
If neither height or width are specified the image is shown in its original size.
1
Thumbnail generation mode
Works like mode 0, but images are never enlarged.
2
Scale to exact target size with cropping
The image is scaled (enlarged or shrinked) to fill the complete target area and match height or width exactly. The aspect ratio is not changed. Overlapping parts of the image are cropped.
3
Scale and keep image proportions, target size variable
The image is scaled (enlarged or shrinked) to fit the target size. Aspect ratio is kept intact. The scaled image will not be padded or cropped, so target size is likely not the exact requested size. Hence, if you use this option you may also want to set noDim or partialTag to true. Otherwise, the browser will scale the image again.
4
Scale to the exact target size ignoring the aspect ratio.
If width and height are given both, the image is scaled exactly to that sizes. If at least one of the sizes is not explicitely specified, the aspect ratio is kept.
5
Deprecated. Not supported anymore. Behaves similar to 1.
scalePositionfalsetruejava.lang.StringSpecify how the original image is placed if cropped or padded. The following values are supported:
0 (default)
center
1
lower left
2
lower right
3
lower middle
4
center left
5
center right
6
upper middle
7
upper left
8
upper right
scaleFilterfalsetruejava.lang.StringSpecify filters applied to the image (and also to a possibly present padding).
The following values can be given as colon (":") separated list:
shadow
Adds a shadow effect to the image.
grayscale
Renders the image in grayscale.
scaleQualityfalsetruejava.lang.StringAn non-negative integer specifying the scale quality in percent.
Allowed are values between 0 and 100, where 0 is a special value to use the default quality. The value has only influence on image formats that support a quality setting, e.g. JPEG.

Default: 0.
scaleColorfalsetruejava.lang.StringThe color used as backgroud if padding is neccessary. The following values are supported:
transparent (default)
Transparent background, if supported by the image type, e.g. for PNG. If transparent background is not supported, e.g. by JPEG, the value defaults to white (FFFFFF).
000000 - FFFFFF
Hexadecimal RGB color code.
scaleRendermodefalsetruejava.lang.StringSet the image processing mode.
The following values are supported:
0 (default)
Quality. Best possible image processing. Might be slow.
1
Medium. Use default JVM settings. Almost as slow as quality mode. Not recommended.
2
Speed. Fast image processing. But quality might be not as good as in quality mode.
The setting is recommended for thumbnail generation.
partialTagfalsetruejava.lang.StringSpecify if only parameters for the HTML <img> tag should be generated, or the whole tag. The following values are supported:
false (default)
Generate the whole HTML <img> tag.
true
Generate only the parameters specified via <cms:img>. These are at least src, width, height.
noDimfalsetruejava.lang.StringControls if the attributes width and height are created. The following values are supported:
false (default)
Attributes width and height are created.
true
Attributes width and height are not created.
altfalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
alignfalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
borderfalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
cssclassfalsetruejava.lang.StringThe value is set as the value of the class attribute in the generated (partial) tag.
hspacefalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
vspacefalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
idfalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
longdescfalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
namefalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
stylefalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
titlefalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.
usemapfalsetruejava.lang.StringAttribute is set unchanged for the generated (partial) tag.

Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.