This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
en:template:image_input [2017/01/24 14:57] Nicolas Ronvel |
en:template:image_input [2017/07/24 12:44] (current) Nicolas Ronvel [Image fields] |
||
---|---|---|---|
Line 6: | Line 6: | ||
"fields": [ | "fields": [ | ||
{ "name": "portray", "label": "Portray", "type": "image", "ratio": 16 / 9 }, | { "name": "portray", "label": "Portray", "type": "image", "ratio": 16 / 9 }, | ||
+ | { "name": "portray2", "label": "Portray", "type": "image", "width": 16, "height": 9 }, | ||
] | ] | ||
</code> | </code> | ||
Line 12: | Line 13: | ||
The ''ratio'' property is an optional value, with a default value of 1. It accepts a numeric value representing the ratio of the image width by the height. The best way to get a correct value is to set the value to the width / height of the image canvas field related to this editable field. A 1 will result in a square cropping area. | The ''ratio'' property is an optional value, with a default value of 1. It accepts a numeric value representing the ratio of the image width by the height. The best way to get a correct value is to set the value to the width / height of the image canvas field related to this editable field. A 1 will result in a square cropping area. | ||
+ | |||
+ | The ''width'' and ''height'' properties act the same as the ''ratio'' one. They can be used instead of the ''ratio'' property to set a ratio with the same width and height than the image. | ||
===== Using the variable ===== | ===== Using the variable ===== | ||
An image field stores the image as a [[https://en.wikipedia.org/wiki/Data_URI_scheme|Data-Url]]. Inside the canvas, when a property requires an url to an image, you can then instead set it to the variable ''$portray''. See also the [[Dataurl variables]]. | An image field stores the image as a [[https://en.wikipedia.org/wiki/Data_URI_scheme|Data-Url]]. Inside the canvas, when a property requires an url to an image, you can then instead set it to the variable ''$portray''. See also the [[Dataurl variables]]. |