I’m trying to have different images on the same project, for different purpose.
But I don’t really achieve to filter them in my front-end right now.
What I would like is a hero part, where the user can upload an hero image.
hero:
label: Zoomed image
type: files
layout: cards
size: tiny
text: "{{file.name}} - {{file.orientation}}"
multiple: false
search: false
followed by a more general medias
that will generate a slider on the front-end.
medias:
uploads: true
template: VideoImg
label: Images
type: files
layout: cards
size: medium
text: "{{file.name}} - {{file.orientation}} {{file.video}}"
here is the full part of the blueprint :
files:
label: Files
icon: file-image
fields:
info-img:
theme: normal
label: About this project
type: info
text: Contains **{{ page.files.count }}** images. For a total of **{{ page.files.niceSize }}**
hero:
label: Zoomed image
type: files
layout: cards
size: tiny
text: "{{file.name}} - {{file.orientation}}"
multiple: false
search: false
medias:
uploads: true
template: VideoImg
label: Images
type: files
layout: cards
size: medium
text: "{{file.name}} - {{file.orientation}} {{file.video}}"
So it works and let me have two separate places to upload my files, one for the hero, the other for the medias.
Now I would like to fetch my images and later get some filters using ifs
but somehow I can’t manage to filter only the images from medias
but this :
<?php foreach($page->images('medias')->sortBy('sort') as $image): ?>
returns me all the 3 images (not only the two one from the screenshot for example)
Also, obviously, when i delete an image from medias
it’s not deleted from all the image list in my txt file.