Image

Displays an image, deriving the source URL for the image from an asset.

Rollover is a similar component that can create dynamic mouse-over effects as well.

See also: ImageSubmit , Rollover

Parameters

Name Type Direction Required Default Description
image IAsset in yes The image to show.

Body: removed

Informal parameters: allowed

Reserved parameters: src

Examples

Inserts the static context path based image.

This example uses a <context-asset> to reference the image.

PoweredByTapestry Screen Shot

HTML Template

<table cellpadding="8" valign="middle">
<tr>
 <td>
  <a href="http://jakarta.apache.org/tapestry/">
   <img jwcid="@Image" image="asset:imageAsset" alt="View Tapestry Home"/>
  </a>
 </td>
 <td>
  <font color="navy" size="+2"><b><i>Powered by Tapestry</i></b></font>
 </td>
</tr>
</table>

Page Specification

<asset name="imageAsset" path="/images/poweredby.png"/>



Inserts the dynamic image obtained from the page's NewsItem property.

This example uses the ExternalAsset to reference the image's URL.

Image Screen Shot

HTML Template

<table cellpadding="8">
<tr>
 <td>
  <h4><span jwcid="@Insert" value="ognl:newsItem.title"/></h4>
  <span jwcid="@Insert" value="ognl:newsItem.body"/>
  <p>
  Date : <span jwcid="@Insert" value="ognl:newsItem.date" format="ognl:@NewsItemPage@DATE_FORMAT"/>
 </td>
 <td>
  <img jwcid="@Image" image="ognl:newsItem.imageAsset" alt="ognl:newsItem.summary"/>
 </td>
</tr>
</table>

Page Specification

<property name="orderItem" type="com.dsconsulting.cms.model.NewsItem"/>

Java classes

public abstract class NewsItemPage extends BasePage {
    public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd MMM yyyy");

    public abstract NewsItem getNewsItem();
}

public class NewsItem implements Serializable {
    private String title;
    private String body;
    private String summary;
    private Date date;
    private String imageURL;

    public NewsItem(String title, String summary, String body, Date date,
            String imageURL) {
        this.title = title;
        this.body = body;
        this.summary = summary;
        this.date = date;
        this.imageURL = imageURL;
    }

    public String getTitle() { return title; }

    public String getBody() { return body; }

    public String getSummary() { return summary; }

    public String getDate() { return date; }

    public IAsset getImageAsset() { return new ExternalAsset(imageURL, null); }
}