Muut
November 3, 2014, 10:26pm
21
Actually in current version there is not a good way to do this.
However, i’ve just commited a method github (quality()
) that let’s you do this for example:
{% set blog_image = page.media.images|first.grayscale().contrast(30).quality(90).brightnes s(-100).colorize(-35,81,122) %}
You can add this method yourself to your current version. It will be part of the next release.
Muut
November 4, 2014, 4:13am
22
Muut
November 4, 2014, 6:02pm
23
Thank you rhukster, Works like a charm
Muut
July 6, 2016, 8:21am
24
Hey, is there any possibility to set a folder, where all images are in?
Muut
July 6, 2016, 10:38am
25
Is this related to the topic? You want a random image from that folder?
Muut
July 6, 2016, 11:33am
26
yes from a defined folder
Muut
July 6, 2016, 11:42am
27
You can have a user/pages/images folder, and randomize an image from that folder with page.find('/images').media.images|randomize|first
Muut
July 31, 2016, 7:28pm
28
You can have a user/pages/images folder, and randomize an image from that folder with page.find(‘/images’).media.images|randomize|first
Thanks for this, it works very well for the blog template. But I cannot make it work with showcase item of a modular page. It chooses one random image at first when you clear the site cache but then keeps using the same image even though randomization works on the blog page. Should I change something in the syntax to make it work with showcase items?
Muut
July 31, 2016, 7:45pm
29
I have also tried this syntax but it does the same thing; picks a random image just at first load.
{% set showcase_image = random(page.find('/images').media.images) %}
---
Muut
July 31, 2016, 9:23pm
30
You could try to disable the caching in the page Advanced tab
Muut
July 31, 2016, 9:27pm
31
The same syntax works on the blog template without disabling the caching though? I’d like to keep caching enabled.
Muut
July 31, 2016, 9:34pm
32
I never tried the random function in a modular page, so i can’t help
Muut
August 2, 2016, 5:51am
33
I guess this is not possible. Oh well, I think I’ll need to upload images twice. One set for the showcase using the code in the first reply and one set for the blog page using the code I quoted before.
Muut
August 2, 2016, 5:59am
34
Hmm… Nope, I could not make this work for modular page showcase template either…
{% set showcase_image = page.media.images|randomize %}
So what I get is, random image thing works with regular pages but not modular pages.
Muut
December 7, 2016, 5:43pm
35
Working for me in modular pages with the
{% set showcase_image = page.find('/images').media.images|randomize|first %}
method. The problem I’m having is only jpegs are displayed but gifs are ignored, I guess because calling
images
ignores the gif ‘animated’ filetype. I wonder if there’s a method to call for any media, not just images.
Muut
December 7, 2016, 6:40pm
36
Use .all
instead of .images
Muut
June 24, 2017, 8:06am
37
I have a question… to hide some of the images in the media.images how could we do it? ext. 00.jpg 01.jpg ??
Muut
June 25, 2017, 3:14pm
38
Maybe loop over the array first, and remove specific images, then after that call |randomize
filter,