Documentation
Integration / TinyMCE Option: moxiemanager_image_template
This TinyMCE specific option enables you to insert the selected images as custom HTML. The option expects an HTML string with variables that gets replaced with file data. This template is used by the insertfile toolbar button and gets used when you insert images.
Variables
Variable | Description |
---|---|
url | Url to the selected file. |
name | Name of the selected file. |
path | Absolute path to the selected file. |
size | Size of the selected file in bytes. |
parentPath | Absolute path to the parent directory of the selected file. |
meta.width | Width of the selected image. |
meta.height | Height of the selected image. |
meta.thumb_url | Url to the thumbnail for the selected image. |
meta.thumb_width | Width of the thumbnail for the selected image. |
meta.thumb_height | Height of the thumbnail for the selected image. |
Encoders
Variable values can also be encoded to various formats. These are the built in encoders:
Name | Description |
---|---|
urlencode | Encodes the variable in url encoding format. |
xmlEncode | Encodes the variable in XML encoding. For example these: < > & " '. |
sizeSuffix | Adds a suffix to sizes for kb/mb etc. |
Examples
Insert image thumbnail with lightbox link to fullsize image:
tinymce.init({
...
moxiemanager_image_template: '<a href="{$url}" rel="lightbox"><img src="{$meta.thumb_url}" /></a>'
});