LinkImage(path, [width], [height], [mode]) Last updated: 16. May 2023
Creates a link to an image within a document. Only works from site display templates for documents.
Parameters
Name | Type | Description |
---|---|---|
path | string | Date on which to add days to. |
width (optional) | number | Target width for scaling (behaviour varies, see specified mode) |
height (optional) | number | Target height for scaling (behaviour varies, see specified mode) |
mode (optional) | number | See list and description of modes: https://developers.docly.net/JavaScript/Filesystem-functions/Image-scaling |
Returns
A working link to the specified image and scaling.
Example
Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.When using src attributes:
<img src="#docly.linkImage(Image1, 160, 120, 1)#" alt="Image" />
When using style background image or other plugins:
<div style="background-image:url('~#docly.linkImage(Image1, 160, 120, 1)#')"></div>
Plugin example:
<div data-plugin-image="~#docly.linkImage(Image1, 160, 120, 1)#"></div>
Output
The #JS code above produces the output shown below:No demo available.