Wml-images

提供:Dev Guides
移動先:案内検索

WML-画像

<img>要素は、WAPカードに画像を含めるために使用されます。 WAP対応のワイヤレスデバイスは、ワイヤレスビットマップ(WBMP)イメージ形式のみをサポートしていました。

WBMPイメージには、黒と白の2色のみを含めることができます。 WBMPのファイル拡張子は「.wbmp」で、WBMPのMIMEタイプは「image/vnd.wap.wbmp」です。

<img>要素は、次の属性をサポートしています。

Attribute Value Description
align
  • top
  • 中間
Alignment of the image
alt alternative text Sets an alternate text to be displayed if the image is not displayed.
height
  • px
  • %
Height of the image in pixels or percentage. If you specify the value in pixels, the syntax is "140", instead of "140px".
hspace
  • px
  • %
Sets white space to the left and right of the image. If you specify the value in pixels, the syntax is "140", instead of "140px".
localsrc cdata Sets an alternate representation for the image. If this attribute is set, the browser will use it instead of the "src" attribute.
src image url A path to wbmp image.
vspace
  • px
  • %
Sets white space above and below the image. If you specify the value in pixels, the syntax is "140", instead of "140px".
width
  • px
  • %
Sets the width of the image.If you specify the value in pixels, the syntax is "140", instead of "140px".
xml:lang language_code Sets the language used in the element
class class data Sets a class name for the element.
id element ID A unique ID for the element.

「.wbmp」画像の作成方法

「.wbmp」画像を作成するための無料のツールがインターネット上で利用可能です。

Nokia Mobile Internet Toolkit(NMIT)には、使用できるWBMPイメージエディターが付属しています。 NMITを使用して、既存のGIFまたはJPG画像ファイルをWBMPファイルに変換できます。

別の無料ツールはhttp://www.imagemagick.org/[ImageMagick]で、WBMPイメージの作成に役立ちます。

以下は、<img>要素の使用法を示す例です。

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">

<wml>

<card title="WML Images">
<p>
This is Thumb image
<img src="/images/thumb.wbmp" alt="Thumb Image"/>
</p>

<p>
This is Heart image
<img src="/images/heart.wbmp" alt="Heart Image"/>
</p>

</card>

</wml>

これにより、次の結果が生成されます。

WAP例8