Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

Images should be sorted by filename but it seems random or by date(?)

Started by Japhy 7 years ago · 1 replies · 512 views
7 years ago

I searched the forum and found some similar but old topics and not really an answer why this is happening.

I have many galleries, and upload many images to a single post. In the backend images are not sorted by filename. It seems random, maybe date. My galleries show pictures in the same order.

I always use the same naming scheme as to avoid order problems

2019-06-15-Image1
2019-06-15-Image2
2019-06-15-Image3
2019-06-14-Image1
2019-06-14-Image2
2018-07-12-Images....
Etc

Other naming schemes don't work as expected either. Any ideas?

regards

7 years ago

Maybe it has something to do with the PHP asort function

Anyway I solved it in my gallery template twig...in case someone stumbles upon this post.

This orders them from new to old (in my case)

{% for image in page.media.images|sort|reverse %}

Suggested topics

Topic Participants Replies Views Activity
General · by jean-louis67, 3 days ago
2 84 2 days ago
General · by Andy Miller, 7 days ago
0 147 7 days ago
General · by Veehem, 1 week ago
0 146 1 week ago
General · by milkboy, 1 week ago
0 142 1 week ago
General · by ian russell, 2 weeks ago
2 226 2 weeks ago