Command macros 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*$

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 ‘?’, and 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 override the same commands in the request if they occur before the macro invocation in the request. This processing flow is different from catalog::Modifier, where commands in the request string 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. However, a macro can only be invoked if it is already defined at the time the macro definition is parsed. This workflow is done 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.

Example section-2f73d36ac8d64254a03bae5afeae2fb9

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

You 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

Because wid= is different for the third request, you can simply override the value after the macro is invoked (specifying wid=before $view$ has no effect).

See also section-8cdba0ed2480444ca61e719e54f8871c

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

recommendation-more-help
a26166cd-f2f4-45ce-996d-96a0f0d6cf49