Image

From MegaZine3
(Redirected from Img)
Jump to: navigation, search


The img element can be used to load and display images. Supported image formats are JPG, PNG and GIF (although loaded GIFs will not be animated), as well as SWF for other Flash movies.

Contents

Attributes

Quality difference when using anti aliasing or not.

aa

Determines whether to use anti aliasing for the loaded image (only for images, not for Flash movies). Excessive use might lead do reduced performance.

height

The height of the element. If not given, uses the actual size of the loaded element. If the given value is smaller than 1 the size is interpreted to be relative to the actual size, i.e. the loaded element is scaled by that factor.

keepar

Determines whether the images aspect ratio should be kept when resizing it using the height or width parameter. E.g. if set to true, when setting img@width to 200, with the original width being 400, the height will be reduced to 1/2 of it's original height, too.

sameappdomain

Only useful when loading SWF files. Determines whether the loaded SWF should be loaded into the same ApplicationDomain as the engine. This can help working around problems based on different code base versions (e.g. if the SWF uses interfaces of the engine of an older version, checks such as variable is ISomeInterface can fail otherwise, or to allow using fonts embedded in the loaded SWF in other places in the engine, e.g. in the GUI).

samesecdomain

Only useful when loading SWF files. Determines whether the loaded SWF should be loaded into the same SecurityDomain as the engine. Use with care, may be used to work around sandboxing issues.

src

The path to the image or Flash movie to display. This can be an absolute or a relative path. Relative paths are (normally) relative to the megazine.swf file.

cache

Determines whether to allow the use of Flash's cache or not. If disabled, the image will always be loaded from the server (which obviously leads to increased bandwidth use, but also to longer wait times for the user). Only for very special cases, where images are generated dynamically or are replaced very frequently, to avoid problems with clients not getting the most up-to-date version (because of the cache).

rasterize

Determines whether a loaded flash movie (SWF) should be cached as an image. This only makes sense when the loaded SWF-file contains many vector graphics (e.g. text). Animated flash movies will only show the first frame (or rather: the frame that was visible when the snapshot was created; this can vary). Possibility to interact with the loaded SWF is lost.

Has no effect on images.

width

The width of the element. If not given, uses the actual size of the loaded element. If the given value is smaller than 1 the size is interpreted to be relative to the actual size, i.e. the loaded element is scaled by that factor.

yt

This is a very specialized attribute, meant in combination for youtube videos loaded into the book via this element. It is necessary to tell the engine to treat the loaded content different for scaling. This means it has only to be set if the loaded video should be scaled (width or height are set). Otherwise it is not necessary.

When loading youtube videos, the following "template" should be used:

<img src="http://www.youtube.com/v/VIDEOID?version=3"/>

where VIDEOID is the ID of the video to embed, which can look something like this: tprMEs-zfQA

Important: youtube videos are a somewhat difficult matter, as they do not allow the SWF that loaded them creating a snapshot. This means it is

As you see, this has quite some limitations, so in general it is strongly recommended to use a 'server-local' video you have full control over.

Examples

<book>
    <chapter>
        <!-- ... -->
        <page>
            <img src="data/background.jpg"/>
            <img src="data/form.swf"/>
        </page>
        <!-- ... -->
    </chapter>
</book>
MegaZine3 Core-related articles
Book elements Book · Chapter · Page · Spreadpage
Page elements Area · GIF · Image · Navigation · Sound · Text · Video
Personal tools
Namespaces
Variants
Actions
Navigation
documentation
miscellaneous
Toolbox