83. resizeImage

Parameter syntax:

[ attribute_name['='[attribute_value]] ]+

This command allows to resize an image by removing one or more attributes and/or setting one or more attributes to values expressed in pixels.

attribute_name=attribute_value

Specifies that attribute attribute_name must be set to value attribute_value (which may be the empty string).

An attribute name is specified using the {namespace_URI}local_name notation. Examples: alt, {}alt, {http://www.w3.org/1999/xlink}:href, xml:id.

attribute_name

Notice there is no '=' sign. Specifies that attribute attribute_name must be removed.

This command has been designed to be bound to the following application events in XMLmind XML Editor - Configuration and Deployment. These application events are generated by an image-viewport() in XMLmind XML Editor - Support of Cascading Style Sheets (W3C CSS) when the user drags one of the handles displayed around the image:

rescale-image

Resize the image, but always preserve its aspect ratio.

resize-image

This application event is generated when the user drags a handle while pressing Ctrl (Cmd on the Mac). This allows to distort the image.

Binding one of the above application events to a command allows to have one or more of the following variables substituted in the parameter of the bound command:

%{width}

The new width of the image expressed in pixels.

%{height}

The new height of the image expressed in pixels.

%{preserveAspect}

true if the aspect ratio has been preserved while the user dragged the resize handle; false otherwise.

XHTML example:

<binding>
  <appEvent name="resize-image" />
  <command name="resizeImage" 
           parameter="height=%{height} width=%{width}" />
</binding>

<binding>
  <appEvent name="rescale-image" />
  <command name="resizeImage" parameter="height width=%{width}" />
</binding>

DocBook example:

<binding>
  <appEvent name="resize-image" />
  <command name="resizeImage" 
           parameter="contentdepth=%{height} contentwidth=%{width} 
                      scale scalefit" />
</binding>

<binding>
  <appEvent name="rescale-image" />
  <command name="resizeImage" 
           parameter="contentdepth contentwidth=%{width} 
                      scale scalefit"/>
</binding>