Show TOC Start of Content Area

Object documentation Image  Locate the document in its SAP Library structure

Definition

Displays a bitmap in GIF or JPEG format. The width and height of the image can be specified.

·        alt

Defines an alternative text for the 'src' attribute. If the 'src' bitmap cannot be found or opened (for example, unrecognized graphic format) the 'alt' text is displayed with an red X in front of it and surrounded by a frame indicating the bitmap size.

If no 'tooltip' attribute is set for the image the alternative text is displayed as the mouse cursor passes over the image, or as the mouse button is pressed but not released.

·        height

Defines the height of the bitmap. If 'height' is omitted the height of the image is determined by the bitmap itself.

·        hoverMenuId

Defines which hover menu is displayed for this tree node. You can define different trigger methods to display the hover menu. For more details, see hover menu.

·        id

Identification name of the image.

·        imageMapId

Identification name of the imageMap control that is associated with the image. The imageMap control allows you to define areas on the image that are clickable. The areas can be associated with a link or an event. For more details on imageMap, see imageMap control description.

·        src

Name of bitmap (=source). The name of the bitmap is case sensitive. To have access to MIME delivered with the portal see "accessing MIME". The images are usually stored in the public resource path of the component in the subfolder /images. The public resource path can be determined with the JSP command:

<% String PublicURL = componentRequest.getPublicResourcePath(); %>

 

You can also get the complete path to image include the subfolder /mimes with the command:

<% String ImageURL = componentRequest.getPublicResourcePath() +
                     "/../mimes/"; %>

 

Note

We use the string variable ImageURL in following table to demonstrate the setting of the src attribute.

 

Another possibility is to get the full URL of the image and set the src attribute in a scriptlet.

<%

IResource rs = componentRequest.getResource(IResource.IMAGE,
               "../mimes/mypicture.gif");

image.setSrc(rs.getResourceInformation().getURL(componentRequest));

%>

 

·        tooltip

Defines the hint of the image which is displayed as the mouse cursor passes over the image, or as the mouse button is pressed but not released.

·        width

Defines the width of the bitmap. If 'width' is omitted the width of the image is determined by the bitmap itself.

 

Attributes

M

Values

Usage

alt

*

String

 

Taglib
alt="Walldorf picture"

Classlib
setAlt ("Walldorf picture")

height

 

Unit

Taglib
height="150"

Classlib
setHeight="150"

hoverMenuId

 

String

Taglib
hoverMenuId="imgHover1"

Classlib
setHoverMenu (HoverMenu menu)

id

*

String (cs)

 

Taglib
id="Hometown"

Classlib
setId("Hometown")

imageMapId

 

String (cs)

Taglib
imageMapId="imageMap"

Classlib
setImageMap("imageMap")

src

*

String (cs)

Taglib
src="<%=ImageURL+\"wdf.jpd\" %>"

Classlib
setSrc (ImageUrl + "wdf.jpg")

tooltip

 

String

Taglib
tooltip="center of ebiz"

Classlib
setTooltip ("center of ebiz")

width

 

Unit

Taglib
width="300"

Classlib
setWidth ("300")

 

Example

using the taglib

 <hbj:image 
    id=
"Logo" 
    
tooltip="center of ebiz" 
    
width="70" 
    
height="35" 
    
alt="picture saplogo.gif" 
    
src="<%= ImageURL +\"saplogo.gif\" %>
    
/>

 

using the classlib

    IPortalComponentRequest request =
        (IPortalComponentRequest) 
this.getRequest();

    Form form = (Form) 
this.getForm();
    Image image =
        
new Image(
            request.getWebResourcePath() + 
"/../mimes/saplogo.gif",
            
"picture saplogo.gif");
    image.setTooltip(
"center of ebiz");
    image.setWidth(
"70");
    image.setHeight(
"35");
    form.addComponent(image);

 

Result

This graphic is explained in the accompanying text

 

 

End of Content Area