Return to doc.sitecore.com

Valid for Sitecore 5.3
3.  <sc:image> Enhancements
Prev

As with previous Sitecore releases, the <sc:image> element generates an HTML img tag for the specified image field on the selected item.  The table below lists the attributes supported in Sitecore 5.3.

Name Shorthand Legal Values Default Value Description
field Lower case name of the image field (same as previous releases).
select XPath expression '.' An XPath expression which selects an item (same as previous releases).
allowStretch as true | false false Allow stretching the image beyond its original size?
backgroundColor bc Color names (such as black or red) and HTML hex color codes (such as CE55E2) black Background color for the border added when an image is stretched beyond its original size (and allowStretch=false).
database db Any Sitecore database defined on the site. content database of the current site The name of the Sitecore to pull the image from.
disableMediaCache dmc true | false false Disable the media cache for this request?  If true, the image will always be retrieved from the database, bypassing the media cache.
height h Any positive integer The height of the image. Be sure to include as=true if the height will be larger than its original size.
language la Any valid language name Retrieve the image from a specific language version of the item.
maxHeight mh Any positive integer Maximum height of the image to display.  Scale the image down to this size if necessary.
maxWidth mw Any positive integer Maximum width of the image to display.  Scale the image down to this size if necessary.
scale sc Any positive floating point number using a dot as a decimal point (such as 1.5, which corresponds to 150%) Scale factor for the image to display.  Be sure to include as=true if the image will be scaled to larger than its original size.
thumbnail thn true | false false Display a thumbnail of the requested file, useful for images as well as other media types, such as PDF, flash, and so on.
version vs Any positive integer Retrieve the image from a specific version of the item.
width w Any positive integer The width of the image. Be sure to include as=true if the width will be larger than its original size.
 
Prev