Photographer Gallery

Good day ! How to use folders in the gallery ?
pages/2.wedding/couple-1
pages/2.wedding/couple-2

Exaple:
gallery:

  • filter: couple 1
    image: ?/couple-1-01.jpg
  • filter: couple 1
    image: ?/couple-1-02.jpg
  • filter: couple 2
    image: ?/couple-2-01.jpg

Thanks!

… and how to use filter consisting of two or three words ?

You have to open gallery.md

filters:
  - name: people
  - name: macro
  - name: nature
  - name: night
  - name: panoramic
  - name: sports 
gallery:
  - filter: people
    image: page3_bigimg1.jpg
    description: quia non numquam
  - filter: people
    image: page3_bigimg2.jpg
    description: Sed ut perspicia
  - filter: macro
    image: page3_bigimg3.jpg
    description: natus error sit
  - filter: nature 
    image: page3_bigimg4.jpg
    description: voluptatem accusantium
  - filter: night
    image: page3_bigimg5.jpg
    description: non numquam eius mo
  - filter: night
    image: page3_bigimg6.jpg
    description: rcitationem ullam cor
  - filter: panoramic
    image: page3_bigimg7.jpg
    description: poris suscipit labori
  - filter: panoramic
    image: page3_bigimg8.jpg
    description: Quis autem vel eum iu
  - filter: panoramic
    image: page3_bigimg9.jpg
    description: eprehenderit qui in
  - filter: sports
    image: page3_bigimg10.jpg
    description: dolorem eum fugiat
  - filter: macro
    image: page3_bigimg11.jpg
    description: pariat esent ju

There you can assign images to filters and add new filters :slight_smile:

Also search these forums for the term gallery and you will find some other useful tips that have helped others.

Karol, Yes, I know how to set up the filter, but I need to within the meaning of the filter was 2 or 3 words, for the moment only works with one word

Example:

  • Filter: sports (working)
  • Filter: sports ball (not working)
  • Filter: sports_ball (working)

How do I get a filter with 2 or more words without an underscore ?

This is actually quite easy to solve with twig. First set filter name with underscore:

– filter: sports_ball

Then in gallery.html.twig find this:

<li><a href="#filter" data-option-value=".{{ item.name }}">{{ item.name }}</a></li>

and replace it with:

 <li><a href="#filter" data-option-value=".{{ item.name }}">{{ item.name|replace({'_': ' '}) }} </a></li>

Basically it’s more like a trick. I’m not the author of the script but in my opinion it has to be one word element, otherwise script will treat two words as a separate objects.

rhukster, I looked at the whole forum by tag gallery, but found no solution … tried different versions of the path, but no results . Please tell me the solution. Thank you!

Good day! Need help using a folder to store the images to the gallery. Thank you!

2.gallery/
/gallery1
/gallery2
/gallery3
/gallery.md

image: ?gallery1? / page3_bigimg1.jpg

Which path should be used to slash and whether something additionally specify in MD file?

Yeah,

image: gallery1/page3_bigimg1.jpg

in gallery.md

Should do the trick.

Unfortunately, this method is not working. In place of the image is blank, there is no mention in the code of the image.

Yeah, it appears that providing path for media functions is not working. I will do research about that and will let you know.

ok, thanks!

Good day, Karol! Any news on the folders for the images?

Hello apoca1ypto,
I apologize for my late reply.
Unfortunately whole operation is not that easy to solve. You can’t just provide image path where image name is. It’s all because default script looks for images only in current page:

{{ page.media[element.image].resize(270, 190).html() }}

It’s possible to search for images in other pages by using something like that:

{{ page.find('/my/other/page').media[element.image].resize(270, 190).html() }}

But that would work only for specified page. Allowing to use different directories would require rewriting whole gallery script, but it’s possible of course.

For now, I would suggest simply use different image names. Much easier and still you can achieve what you want.