This plugin provides a simple component to display random images from your media library.
Add the randomImages
component to the page where you want to display an image.
Path to the source folder in your media library.
Limit the number of returned images. Default is to return all available images.
[randomImages]
sourcePath = "/folder-path/"
limit = 4
==
{% component 'randomImages' %}
You can access all the returned images via
{{ randomImages.images }}
Use can access an ImageResizer
instance for each image via image.resizer
. The creation of thumbnails is currently not implemented. You have to do this yourself.
To automatically resize the images to the viewport size use the OFFLINE.ResponsiveImages plugin.
You can get the orientation of an image via image.orientation
. Possible return values are portrait
and landscape
.
To overwrite the default markup of the component create a
themes/<your-theme>/partials/randomImages/default.htm
. Paste and change the following code as needed.
{% for image in randomImages.images %}
<img src="{{ image.publicUrl | app }}"
class="image-{{ image.orientation }}"
alt=""
/>
{% endfor %}