DynamicImage |
||
Developer’s Guide Home
Installation and Configuration Components Index Calendar Chart Confirmation Data Table Date Chooser Drop Down Field Dynamic Image Folding Panel Hint Label Popup Layer Suggestion Field Tab Set Tabbed Pane Tree Table Two List Selection Utility Components Validation Framework Tag Reference |
The DynamicImage is a component that, unlike the standard JSF HtmlGraphicImage component which displays an image already stored as an application file, provides the ability to display an image which is dynamically generated at run time, or which is not available as an application file but, for example, is retrieved from a database. Key FeaturesSpecifying the ImageTo add the DynamicImage component to a page, use the <q:dynamicImage> tag. The data of the image to be generated dynamically is defined by the model assigned through the data attribute of the <q:dynamicImage> tag. There are two ways to specify the data model:
In the following example, the data model is defined as a byte array: <q:dynamicImage data="#{DynamicImageData.testImageData}"/>
Note that the DynamicImage component does not specifically process the image data. It serves this data to the client's browser with the appropriate content type, so the the only restriction on the file type is that it should be supported by the client's browser.
Customizing the AppearanceYou can specify the width and height of the DynamicImage component in pixels using the width and height integer attributes. The "alt" text that is shown if images are not loaded by the browser can be specified by the alt attribute. The example below shows the use of the appearance-related attributes: <q:dynamicImage data="#{DynamicImageData.testData}" width="100" height="200" alt="Test DynamicImage"/> You can also specify a style for the DynamicImage component by using the style and styleClass attributes. |
|
© 2007 TeamDev Ltd. | ![]() |