flat mode and manual sort #459

Open
opened 2026-10-04 23:59:38 +02:00 by adam · 6 comments
Owner

When going to flat mode, Piwigo doesn't follow the expected sort orders.

Let's imagine you have defined this manual order (for albums and for photos inside the 3 albums)

* album A
** album A2
*** photo A2c
*** photo A2d
*** photo A2b
*** photo A2a
** album A1
*** photo A1b
*** photo A1a
*** photo A1c
** album A3
*** photo A3a
*** photo A3b
*** photo A3c

If "album A" is configured to sort on manual order, then a flat "album A" should display:

* album A
*** photo A2c
*** photo A2d
*** photo A2b
*** photo A2a
*** photo A1b
*** photo A1a
*** photo A1c
*** photo A3a
*** photo A3b
*** photo A3c
When going to flat mode, Piwigo doesn't follow the expected sort orders. Let's imagine you have defined this manual order (for albums and for photos inside the 3 albums) ``` * album A ** album A2 *** photo A2c *** photo A2d *** photo A2b *** photo A2a ** album A1 *** photo A1b *** photo A1a *** photo A1c ** album A3 *** photo A3a *** photo A3b *** photo A3c ``` If "album A" is configured to sort on manual order, then a flat "album A" should display: ``` * album A *** photo A2c *** photo A2d *** photo A2b *** photo A2a *** photo A1b *** photo A1a *** photo A1c *** photo A3a *** photo A3b *** photo A3c ``` <!-- github-sync-id:156266594 -->
Author
Owner

To be able to sort photos this way, we would have to have a "global rank" for photos as <album global rank>.<photo rank>. MySQL can't sort on such value, with a natural case sort. It means Piwigo would have to fetch all images from database, natcasesort them and array_slice them.

To be able to sort photos this way, we would have to have a "global rank" for photos as `<album global rank>.<photo rank>`. MySQL can't sort on such value, with a natural case sort. It means Piwigo would have to fetch all images from database, natcasesort them and array_slice them. <!-- github-comment-id:220964384 -->
Author
Owner

That's tough. What if A1, A2 and A3 have a mix of manual /automatic sort order?

That's tough. What if A1, A2 and A3 have a mix of manual /automatic sort order? <!-- github-comment-id:220964527 -->
Author
Owner

@modus75 actually, I think a photo should always have an image_category.rank (be it defined by hand or by a sorting criterium). It would mean that if you configure your album to sort by "date posted", it will update the image_category.rank accordingly. This is a bit what the plugin "reset manual order" http://piwigo.org/ext/extension_view.php?eid=620 tries to do.

@modus75 actually, I think a photo should always have an image_category.rank (be it defined by hand or by a sorting criterium). It would mean that if you configure your album to sort by "date posted", it will update the image_category.rank accordingly. This is a bit what the plugin "reset manual order" http://piwigo.org/ext/extension_view.php?eid=620 tries to do. <!-- github-comment-id:220966380 -->
Author
Owner

Thanks to Perrick for filing this. If it helps any, Menalto Gallery 1 supported this feature (http://codex.galleryproject.org/Downloads). It treated subalbums and pictures the same, letting you order them together. Then the slideshow would go through them in order, going into subalbums as needed.

Thanks to Perrick for filing this. If it helps any, Menalto Gallery 1 supported this feature (http://codex.galleryproject.org/Downloads). It treated subalbums and pictures the same, letting you order them together. Then the slideshow would go through them in order, going into subalbums as needed. <!-- github-comment-id:220969675 -->
Author
Owner

When I worked on plugin Menalto2Piwigo I realized how different was the database model of Menalto compared to Piwigo (by the way, I understand why they had to redesign it from scratch afterwards... ;-). In this specific case, it makes the feature more complex to implement in Piwigo.

When I worked on plugin Menalto2Piwigo I realized how different was the database model of Menalto compared to Piwigo (by the way, I understand why they had to redesign it from scratch afterwards... ;-). In this specific case, it makes the feature more complex to implement in Piwigo. <!-- github-comment-id:220970808 -->
Author
Owner

I guess they did, because Gallery 2 no longer supported the feature. Haven't been able to get Gallery 3 to install correctly, not sure what it does with this.

I guess they did, because Gallery 2 no longer supported the feature. Haven't been able to get Gallery 3 to install correctly, not sure what it does with this. <!-- github-comment-id:220974801 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#459