Image

From WeBWorK
Jump to: navigation, search

image

Description

Takes a relative path to an image file and creates a URL string to the file. In TeX mode it also creates an eps file and links to it.

Syntax

image(image1, options)
image([image1, image2,image3], options)

Params

image1 is the path to the image to be displayed. The path is fed to the "alias" filter first, so the path can be relative to the "tempDirectory" where on-the-fly images are stored; to the course "htmlDirectory" which keeps more permanent images, or it can live the same directory as the source .pg file of the problem itself.
To process more than one image use [image1, image2,....]
Options are key/value pairs as listed below

Options

Option key Option value Default
width width in pixels 100
height height in pixels 100
tex_size scaling factor with 1000 equal to original size 800

Action

In the various HTML modes it creates a string with an <IMG> tag with the url provided by "alias".
In TeX mode it creates a string with a TeX '\includegraphics' macro with a link to the eps file created by "alias".
One text string is created for each image.

Returns

Either an array of strings (each with an image tag or macro) OR the FIRST string in the array, depending on whether it is called in scalar or array context. (It does not return the size of the array when used in scalar context.) The most common usage is the array context.

Examples

*BEGIN_TEXT
\{ image(insertGraph($graph)) \}

END_TEXT
*TEXT(image("pict1.png"))
follow us