Dynamic Image Assets #914
-
I have a code as below that displays image slideshow:
Problem is, this is a quite static path as it cannot add more images or changing the images provided in the code from WinterCMS admin panel. To be able to change the images, you may have to name the new image just as the original one (doing a replacement). What it needs is that I can add or update the image from WinterCMS admin panel without having to update the HTML code. How can I achieve such a goal? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There's a bunch of different ways that you can achieve what you're looking for in Winter CMS, and which one would fit your case best would depend on where this code gets included on your frontend and how you want to manage it.
For a quick example of the Custom Page Fields feature see below: <div class="carousel-inner">
{repeater name="carousel_items" prompt="Add carousel item"}
<div class="carousel-item active c-item">
{variable name="image" label="Image" type="mediafinder" mode="image"}{/variable}
<img src="{{ image | media | resize(1920, false) }}" class="d-block w-100 c-img">
</div>
{/repeater}
</div> |
Beta Was this translation helpful? Give feedback.
Did you also put the
{% component 'slider' %}
(or whatever it's called) in the code section of the page or did you just add it to the configuration section?