Home >Online Product Documentation >Table of Contents >Images
An image is a component that contains a GIF, JPEG, or some other graphic file. You can place image components within other components (like tables, lists, and repeaters, for example), or directly on the report body.
Alternative: Right-click and select Insert image from the short-cut menu.
The location of all image files must be specified relative to the target destination of the HTML+CSS or XSL-FO. For example, do not specify c:\myFiles\images as a source directory unless that directory is accessible to the finished report.
c:\myFiles\images
In the XML Publisher canvas, an image is represented as a small square with a cross-hatched pattern. Figure 466 shows an image component that includes some text to its right - (photo of the author).
Images are resolved when you preview the report only if the image files are accessible to Stylus Studio using the source information you have specified. Unresolved images are rendered as red Xs, as shown in Figure 467:
You can use static and dynamic images in a report. A static image is one that never changes. An example of a static image is a corporate logo that appears in a fixed place on a report. To specify a static image, just the complete file URL in the image's Source property - file://c:\MyProjects\StylusLogo.gif, as shown in Figure 468.
file://c:\MyProjects\StylusLogo.gif
A dynamic image is one whose source changes based on the context defined for it. An example of a dynamic image is the cover art for the movies in the videos.xml document - the image varies based on the video id as determined by the current context.
videos.xml
To specify a dynamic image, you need to define the image component's Source property's Context and XPath sub-properties:
When you specify these properties, Stylus Studio displays <dynamic> in the Source property field.
Regardless of whether you are using static or dynamic images, the image source must be available to the finished HTML+CSS or XSL-FO report.
The cover art for the movies in the videos.xml document are written to the \examples\VideoCenter\images\video\ directory where you installed Stylus Studio. The name of each .gif file is the same as the value of the id attribute of the video repeating element. We want to create a simple table displaying the movie's title and its cover art, as shown in Figure 469.
\examples\VideoCenter\images\video\
.gif
id
video
To create this report in XML Publisher, we would:
$video
title
result/videos/video
concat(@id)".gif"
c:\Program Files\Stylyus Studio\examples\VideoCenter\images\video\
By default, Stylus Studio displays the image in the finished report using the source file's dimensions. You can use the image component's Width and Height properties to specify a different size. When you do this, Stylus Studio changes the dimensions of the image glyph (see Figure 466) on the canvas to reflect the change.