### 23.5.2 Replacing or surrounding a graphic with macro code

You can specify code to be included before, after, or in place of any graphic, or group of graphics, by assigning a macro or HTML code to one or more graphic IDs. For example:

[GraphStartMacros]

; Graphic ID = text of macro to put before graphic

ax78ec24=<hr /><br />

[GraphEndMacros]

; Graphic ID = text of macro to put after graphic

ax78ec24=<hr />

[GraphReplaceMacros]

; Graphic ID = text of macro to put instead of graphic

aq*=<$Thumbnail>

When you specify a macro or other HTML code to replace a graphic, Mif2Go ignores any preceding or following code or macro you assign to that same graphic in one of the other [Graph*Macros] sections.

To avoid having graphics wrapped in paragraph tags when you use [GraphReplaceMacros], see §23.5.6 Omitting paragraph tags around graphics.

List exceptions by graphic ID

If the macro should apply to all but a few images, you can list the images to exclude by assigning nothing to their IDs; list the exceptions first. For example:

[GraphReplaceMacros]

aa12345=

aa23456=

*=<$YourMacro>

See §23.5.1.1 Using wildcards to assign properties to graphics.

Use predefined macro variables

The macro definition (or HTML code) can include the following predefined macro variables, which reference the graphics to which the code or macro is assigned:

<$$_graphbase> | File name for <img src= /> attribute, without extension
<$$_graphsrc> | File name for <img src= /> attribute, with extension
<$$_graphorighigh> | Original image height in pixels, before any [GraphScale], [GraphHigh], or [GraphWide] setting is applied
<$$_graphorigwide> | Original image width in pixels, before any [GraphScale], [GraphHigh], or [GraphWide] setting is applied

If you assign code instead of a macro name, the code must be all on the same line.

Replace graphics with thumbnails

To show each graphic in a smaller size (a “thumbnail”), for example, you could specify something like the following (see §4.5 Using wildcards in configuration settings):

[GraphReplaceMacros]

*=<$Thumbnail>

[Thumbnail]

<a href="<$$_graphsrc>"><img src="<$$_graphsrc>" width="25%" /></a>

For a way to provide thumbnails in the form of links to the graphics they replace, see §18.7.3.2 Using thumbnails for links to illustrations.

View full-size graphics on demand

If you import high-resolution bitmap images into your document by reference, and in FrameMaker you scale them down to fit the page, the scaled-down images might not show clearly in HTML. You can make these images clickable in HTML, so the graphic can be viewed full size. For example:

[GraphReplaceMacros]

aa4de33f=<$FullView>

[FullView]

<a href="<$$_graphsrc>" target="_blank"><img src="<$$_graphsrc>"

width="<$$_graphorigwide>" height="<$$_graphorighigh>" /></a>

| 23.5.1.4 Creating named groups of graphics |  | 23.5.3 Converting only the visible portion of a graphic |