Product support

Get help in the plugin support forum.


This plugin provides a simple CMS component to display random images from your media library.

Feature plans

  • Provide a thumb method on each image to resize it.

Use the component

Add the randomImages component to the page where you want to display an image.


  • sourcePath - path to the source folder in your media library.
  • limit - limit the number of returned images. Default is to return all available images.


sourcePath = "/folder-path/"
limit = 4

{% component 'randomImages' %}

Access the images directly

You can access all the returned images via

{{ randomImages.images }}
Orientation and resizer

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.

Overwrite default markup

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 }}"
{% endfor %}

Fixed bug with limit property

Oct 03, 2019


Switched to System\Classes\MediaLibrary since Cms\Classes\MediaLibrary has been deprecated

Feb 06, 2019


Added support for Rainlab.Pages snippets

Sep 21, 2016


First version of RandomImages

Feb 03, 2016