Forum archive 2000-2006

Michael Gage - image

Michael Gage - image

by Arnold Pizer -
Number of replies: 0
inactiveTopicimage topic started 3/26/2003; 10:21:49 PM
last post 3/26/2003; 10:21:49 PM
userMichael Gage - image  blueArrow
3/26/2003; 10:21:49 PM (reads: 1448, responses: 0)

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 keyOption valueDefault
widthwidth in pixels 100
heightheight in pixels 100
tex_sizescaling 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"))

See Also

The "alias" macro defined in dangerousMacros.pl does much of the work of determining the correct URL for the image file and in directing the creation of an eps file if it is needed.
"images" is an obsolete verb which processes more than one image at a time. Use image([image1, image2,...]) instead.

Macro Definition File

PGbasicmacros.pl

 

<| Post or View Comments |>