layout | title | searchable | versions | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
widget |
Gallery |
true |
|
The gallery widget allows the user to display a selection or group of images that have been uploaded to the Images section of the Editor. By default the gallery comes with no images, the user must select them when they select the widget. If you are using the image gallery as part of your template you can state the images that are shown.
{% highlight python %} {% raw %}
{{widget('gallery', 'imagegallery', {})|raw}}
{% endraw %} {% endhighlight %}
The above example will display an area in the template where the user can select and then add images to, it will not show any images by default.
{% highlight python %} {% raw %}
{{widget('gallery', 'imagegallery', { 'showTitle': true, 'showDescription': true, 'images':[ { 'url':'http://placehold.it/350x300', 'title':'First image title', 'description': 'First image description' }, { 'url':'http://placehold.it/350x400', 'title':'Second image title', 'description': 'Second image description' }, { 'url':'http://placehold.it/650x300', 'title':'Third image title', 'description': 'Third image description' } ] })|raw}}
{% endraw %} {% endhighlight %}
{% highlight html %} {% raw %}
{% endraw %} {% endhighlight %}
The following options are available for the gallery widget:
-
showtitle
: Will show or hide the title,true
for showing andfalse
for hiding the image title. This can be overwritten by the user. -
showDescription
: Will show or hide the description,true
for showing andfalse
for hiding the image description. This can be overwritten by the user. -
images
: The default images for the gallery, see Setting images for more details.
{% highlight python %} {% raw %} ... { 'imageWidth': '350', 'imageHeight': '300', 'url':'http://placehold.it/350x300', 'title':'First image title', 'description': 'First image description' } ... {% endraw %} {% endhighlight %}
To see the above example in context please refer to the Example usage. The images will be shown as default in the template, but they won't be shown in the images panel of the Editor. If the user replaces the images they will no longer be accessible, you will need to state them in the metadata file in order for them to appear in the images panel. The url
can be either an internal or external image path, all other image settings are optional.