Wireless Markup Language (WML) Tutorial

Images

WAP devices tend to have very small monochrome screens, approximately 100 x 50 pixels for a WAP phone. They use their own image format, wbmp, which fortunately is available on most graphics packages. The img element is used to draw images. As the img tag doesn't have a closing tag, a forward slash is required at the end of the element.The following table shows the attributes available for the img element.

Attributes for Images
Attribute Description

align

Determines how the image is aligned with the text. The possible values are:

  • top
  • middle
  • bottom

alt

Textual description of the image. The text is displayed on the device while the image is being downloaded. If images are not supported on the device, the alternative text is displayed in its place.

height

The height of the image. If this attribute is provided, the required space is allocated to the rendered page while the image downloads. The attribute may also be used to resize the height of an image.

hspace

Used to determine the amount of white space around the sides of the image.

src

Used to specify the location of the image source.

vspace

Used to determine the amount of white space around the top and bottom of the image.

width

The width of the image. If this attribute is provided, the required space is allocated to the rendered page while the image downloads. The attribute may also be used to resize the width of an image.

The following example displays a picture of a smiley face.

smiley.wml

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Welcome">
<p align="center">
    Juicy Studio<br/>
    <img src="images/smile.wbmp" alt="Smile" width="20" height="20"/><br/>
    W@P
</p>
</card>
</wml>

Output From Program

The following shows the cards in the order they appear at 3 second intervals.

The image shows the screen of a mobile phone with the output from the program.

You might also like...

Comments

About the author

Gez Lemon United Kingdom

I'm available for contract work. Please visit Juicify for details.

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match” - Bill Bryson