Summary: An explanation of how to add various types of multimedia objects to your Connexions content. Examples of some of the more common multimedia objects are included.
Connexions modules can contain many different types of multimedia. This document explains how you can add the following types of multimedia objects to a module:
Any type of multimedia object that can be embedded in a Web
page can be put into a Connexions module using the CNXML
media tag. The only requirement is that the object must have
a valid MIME (Multipurpose Internet Mail Extension) type. MIME
is a protocol that enables the transmission of data, such as
sound or movies, over the Internet without first having to be
translated into an ASCII format. See MIME
Types for more information. This module contains
examples of the CNXML entries and their resulting displays for
the different multimedia objects.
The media tag is used to insert media objects into a CNXML document. The media objects can be images, applets, movies, sounds, or any object with a valid MIME type. Media requires the attributes id and alt, and also has optional src, display, and longdesc attributes. Media must contain at least one of the following children tags: image, audio, flash, video, text, java-applet, labview, object, or download.
Below is an example of how to use the media tag.
<media id="media_example" alt="a dog on a bed">
<image mime-type="image/jpeg" src="image1.jpg"/>
</media>
The above code would result in this display:
It is important for authors to remember that not all users are able to experience media the same way. Visually impaired users will not be able to view graphical content, while those hard of hearing will not be able to experience audio content as intended. As an author, should always strive to make their content as accessible as possible to all audiences; in addition to allowing more users to enjoy and benefit from your work, you will also make it easier for many organizations required by policy or law to provide materials that meet accessibility standards.
Alt text is a required attribute of media and should be used to provide brief textual descriptions of visual content. These descriptions can be read by screen reading software packages used to assist visually impaired users. Keep your alt text short but descriptive; imagine somebody trying to describe an image you cannot see and think about the information you would find most important.
longdesc (or "long description") files are used to describe images that are too complex to summarize in alt text. Rather than including the description in the CNXML markup, the full, detailed description is contained in a separate file that is linked from the media element. This allows you to describe the image in as much detail as necessary without needing to keep the description short. A longdesc file:
quarterly_report_desc.html:
<media id="longdesc_example"
alt="a brief description of the quarterly report image would go here"
longdesc="quarterly_report_desc.html">
<image mime-type="image/png" src="quarterly_report.png" />
</media>
quarterly_report_desc.html would most likely be a simple text file describing the details of the chart, including the data points, overall trends, and any other relevant information. A screen reader user would have the option of following this link in order to get a detailed understanding of the data that would otherwise be conveyed and understood by sighted users through visual information.Captioning is another important consideration when dealing with video content. Users who are hearing impaired may not be able to understand all of the information being conveyed in a video, limiting their access to the material being described. This can be addressed by submitting videos that are captioned, allowing those users to read along with the spoken materials. If you are not able to caption your videos, another option is to include audio transcripts of the materials as a module resource that can be easily accessed using a link. While there are no specific tools or standards for providing this type of content, the important thing to remember is to make it as easy as possible for as many people as possible to access the information you are trying to communicate.
Some of the image file types and their corresponding MIME types used in Connexions modules are:
To embed images in your module, insert CNXML entries similar to the following example into the "index.cnxml" file for your module:
<figure id="figure-01">
<title>Example Figure</title>
<media id="figureexample" alt="an envelope with a blue page">
<image mime-type="image/png" src="Xenveope-blue-on-blue.png"/>
</media>
<caption>A graphic image displayed as a figure.</caption>
</figure>
The src attribute in the image tag gives the location
or source of the image that you want to appear in the module. After
loading the image file into the 'Files' tab on your module, simply
provide the full file name (e.g. "envelope-taller.png") to specify
which image should be used.
The actual display for the previous CNXML example is:
| Example Figure |
|---|
![]() |
You can use optional size attributes to control the size of the image displayed in both online and print versions of the content. There are a few things to keep in mind when specifying image sizes in CNXML:
You can adjust the size of the image in the on-line version of your document by using the height and width attributes.
The following code will display the image in its original, default size:
<figure id="element-439">
<media id="tajmahal" alt="The Taj Mahal">
<image src="TajMahal_medium.jpg" mime-type="image/jpeg"/>
</media>
<caption>
The photograph of the Taj Mahal in this figure and the following figures
was taken by <link url="http://www.flickr.com/photos/babasteve/">Steve
Evans</link>. It is licensed for public use under the Creative Commons
Attribution License.
</caption>
</figure>
This code results in the following image:
![]() |
The following CNXML code shows how to display the same image with a specific size (in this case, 250 pixels wide by 250 pixels tall):
<figure id="figure_size_adjusted">
<media id="TajMahal" alt="The Taj Mahal">
<image mime-type="image/jpeg"
src="TajMahal_medium.jpg"
height="250"
width="250" />
</media>
</figure>
The resulting figure is displayed below:
![]() |
When specifying width and height, enter the value in pixels. For example, the code above will produce a print image that is 250 pixels tall and 250 pixels inches wide.
height and width of an image. If you supply only one of these, the other value will be calculated to preserve the same height-width ratio as the original image. You only need to supply both when you wish to change the shape of the image.
height and width attributes do not affect the size of the image in the print (PDF) version of the module. To change the printed size of the image, use the print-height attribute (see below). You can use any combination of print and online sizing attributes for an image.
You can adjust the size of the image in the print (PDF) version of your document by using the print-width attribute. The height of the image will be adjusted proportionately to the width set in print-width. There is no print-height attribute.
The following CNXML code shows how to display the Taj Majal image above with a specific printed size (in this case, 4.5 inches wide):
<figure id="figure_size_adjusted">
<media id="TajMahal" alt="The Taj Mahal">
<image mime-type="image/jpeg"
src="TajMahal_medium.jpg"
print-width="4.5in" />
</media>
</figure>
When specifying print-width include the unit of measurement in the value. This can be in (inches), cm (centimeters), pt (points) or any other value supported in LaTeX. The code above will produce a print image that is 4.5 inches wide and a height proportional to its original dimensions.
print-width attribute does not affect the size of the image when viewing the version of the module. To change the online size of the image, use the height and width attributes. You can use any combination of print and online sizing attributes for an image.
A thumbnail is a small version of an image that, when clicked, displays the larger, full-size version of that image. You can create a thumbnail in your modules by completing the following steps:
media and image elements as you would normally do for a full-sized image. thumbnail attribute to the image element as shown in the example below.
<figure id='thumbnail'>
<media id="thumbnailmedia" alt="The Taj Mahal (thumbnail version)">
<image mime-type='image/jpeg'
src='TajMahal_medium.jpg'
thumbnail='TajMahal_Thumb.jpg'/>
</image>
</media>
</figure>
Connexions allows you to insert an alternate media file in your module that can be formatted and sized specifically for the print version of your content. For example, you may want to provide a color image for online use and a black-and-white image for print. You can also use this feature to provide alternate media types, such as using a Java applet for online use and an image for print.
To create an alternate image for print,
simply include two image elements (or, say, a video element and an image element) inside the
media tag. The first element will be used in the online
version of the module, while the second will be used for the print
version.
The following code gives one example for including an alternate
print image. In this case, online users will see image.png, while image.eps will be used for the print version of the module.
<figure id='printimage'>
<media id="print_image_example">
<image mime-type='image/png' src='image.png'/>
<image mime-type='application/postscript' src='image.eps'/>
</media>
</figure>
media element, the first will be used for the online
version and the second will be used for the print version.
However, if the first element in a media is a longdesc element, the second element will be used online, and the third element will be used for print.You can place two or more images within the same figure using the
subfigure tag. This is useful when you have two
related images that you want to display side-by-side or one
above the other. To display two images within the same figure,
insert CNXML entries similar to the following example into the
"index.cnxml" file for your module:
<figure id="figure-2" orient="horizontal">
<subfigure id="subfigure-1">
<title>Blue on Blue</title>
<media id="sub_example" alt="An envelope with a blue page">
<image mime-type="image/png" src="Xenvelope-blue-on-blue.png"/>
<caption>Subfigure 1.</caption>
</media>
</subfigure>
<subfigure id="subfigure-2">
<title>Orange on White</title>
<media id="sub_example2" alt="An envelope with a white page">
<image mime-type="image/png" src="Xenvelope.png"/>
<caption>Subfigure 2.</caption>
</media>
</subfigure>
<caption>Two images displayed horizontally in one figure.</caption>
</figure>
The resulting figure is displayed below:
|
The orient determines how the subfigures are arrange
respective to one another. This attribute can have a value of either
horizontal or vertical.
You can insert Flash objects in your module. Here is an example of the CNXML code required to include a Flash object:
<figure id='flashfig'>
<media id="new_flash" alt="flash animation of the connexions logo">
<flash mime-type="application/x-shockwave-flash"
src="flash.swf"
height="250"
width="250" />
</flash>
</media>
<caption>"Welcome to Connexions" example Flash object.</caption>
</figure>
figure tags
to allow captions for explanation purposes. The figure
tags are not required to include these media objects in a module.Movies can be added to your module using the same basic structure as with other media types.
<figure id='moviefig2'>
<media id="movie" alt="Building on the Past">
<video mime-type="video/mpeg"
src="Building_on_the_Past.mpg"
width="350"
height="300"
autoplay="false" />
</video>
</media>
<caption>
The Creative Commons movie: "Building on the Past".
Click the Play button to start the movie.
</caption>
</figure>
figure tags
to allow captions for explanation purposes. The figure
tags are not required to include these media objects in a module.Java applets are another media type you can use in your Connexions modules:
<figure id="javafig">
<media id="java_example" alt="a complex sinusoid">
<java-applet type="application/x-java-applet"
code="PhasorDemo.class"
width="430"
height="500" />
</java-applet>
</media>
<caption>3D Animation of a Complex Sinusoid. Click the Run button to start the animation.</caption>
</figure>
figure tags
to allow captions for explanation purposes. The figure
tags are not required to include these media objects in a module.Audio files such as mp3, real audio, and wav files can be inserted into your module quickly and easily. To include audio files in your document, upload the corresponding audio file and include code similar to the following in your "index.cnxml" document:
<figure id='musicscale'>
<media id="music_example" alt="chromatic scale slurred">
<audio mime-type="audio/x-wav" src="chromatic_slurred.wav"/>
</media>
<caption>A chromatic scale performed on clarinet by Michael Lawrence.</caption>
</figure>
The actual display for the previous CNXML example is:
Audio File:
chromatic_slurred.wav |
figure tags
to allow captions for explanation purposes. The figure
tags are not required to include these media objects in a module.For information on including LabVIEW demonstrations in your module, please see Creating LabVIEW demonstrations for Connexions.
Some multimedia objects need options or parameters to display
properly. You can pass this information to the multimedia objects
with the param tag.
The param tag allows you to specify the run-time
settings for an object inserted into XHTML documents.
Here is an example of a param tag for an audio (wav) object:
<figure id="audio2">
<media id="music_example2" alt="Slurred chromatic scale">
<audio mime-type="audio/x-wav" src="chromatic_slurred.wav">
<param name="title" value="Chromatic Scale"/>
</audio>
</media>
</figure>The actual display for the previous example is
Audio File:
Chromatic Scale |