Convert the image markers in HTML from the Rich Text editor into image tags.
When you add images in the Rich Text editor of the Zotonic admin, the
HTML body text does not store
<img> tags, but instead, special
markers containing the picture id plus size and alignment hints.
show_media tag converts these special markers (which are in fact
HTML comments) back into image tags. For this, it uses the template
_body_media.tpl. This template is located in
mod_base and can
be overruled with your own.
Images that are inlined in the body text can have these parameters:
right. Default is
- Choose between
large. These are used for selecting the mediaclass of the image. Which will be like
body-media-large. The default size is
large, displayed as a block (see align above).
- Checkbox if you want to force cropping of the image to the bounding box of the mediaclass. If checked then the crop in the mediaclass is overruled. If not checked then the crop in the mediaclass is used.
- Checkbox if you want to let the image include a link to its own page.
linkis checked then this can be used to set the URL for the link, the link url defaults to the page-url of the shown medium item.
- Caption that will be displayed below the media item. Per default the summary of the media item is used for the caption. If the caption is empty, then no caption is added.
These parameters can be set in the editor dialog ‘Media Properties’. This dialog is shown after clicking on an image in the wysiwyg editor.
_body_media.tpl is included using a catinclude for the media item.
In this way you can switch templates depending on the item category being
You can add your own
_body_media.tpl templates. It will be supplied with
the following data:
|id||The id of the medium item to be displayed.|
|mediaclass||Mediaclass, for example
|crop||If crop is forced,
|link||If the image should link to the medium page|
|link_url||Link to use, defaults to the medium page|
|caption||The caption from the editor|
Besides the above all context variables are passed, this gives the Erlang code the possibility to change the behavior of the media rendering.