Command macros

Command macros provide named shortcuts for sets of commands. Macros are defined in separate macro definition files, which can be attached to image catalogs or the default catalog.

$ *name*$


Macro name.

*name* is not case-sensitive and may consist of any combination of ASCII letters, numbers , ‘-’, ‘_’, and ‘.’ characters.

Macros may be invoked anywhere in a request after the ‘?’, as well as anywhere within a catalog::Modifier or catalog::PostModifier field. Macros can only represent one or more complete Image Serving commands and must be separated from other commands with ‘&’ separators.

Macro invocations are replaced by their substitution strings early during parsing. Commands within macros will override the same commands in the request if they occur before the macro invocation in the request. This is different from catalog::Modifier, where commands in the request string will always override commands in the catalog::Modifier string, regardless of position in the request.

Command macros cannot have argument values, but custom variables may be used to pass values from the request into the macro.

Macros may be nested, with the following restriction: A macro can only be invoked if it is already defined at the time the macro definition is parsed, either by appearing earlier in the same macro definition file, or by placing the definition for such an embedded macro in the default macro definition file.


Macros can be useful if the same attributes are to be applied to different images.

http://server/cat/1345?wid=240&fmt=jpeg&qlt=85&op_usm=5,2&bgc=200,200,200&align=-1,-1 http://server/cat/1435?wid=240&fmt=jpeg&qlt=85&op_usm=5,2&bgc=200,200,200&align=-1,-1 http://server/cat/8243?wid=480&fmt=jpeg&qlt=85&op_usm=5,2&bgc=200,200,200&align=-1,-1

We can define a macro for the common attributes:

view wid=240&fmt=jpeg&qlt=85&op_usm=5,2&bgc=200,200,200&align=-1,-1

The macro would be used as follows:

http://server/cat/1345?$view$ http://server/cat/1435?$view$ http://server/cat/8243?$view$&wid=480

Since wid= is different for the third request, we simply override the value after the macro is invoked (specifying wid=before $view$ would not have any effect).

See also

catalog::MacroFile , catalog::Modifier, Macro Definition Reference

On this page