Sorting dynamic album problem

ctdlg Member
edited March 2021 in General support


Zenphoto 1.5.7 is still unable to sort dynamic albums (alb) by title correctly.
Last updates did not solve this problem.

My titles start with a letter (I, P , S, V ,T) and a semi column - examples below
P : Graux, lavoir
P : Graux , église
I : Bazoilles, lavoir
I : Bazoilles, calvaire

In a dynamic album, I will get V : Munich ... before V : Conakry... (not good if sorted by title)
V : Munich ... after V : Monaco (ok if sorted by title)

It seems sorting is done on some groups of pictures randomly

Note : real albums are always sorted as expected according to settings.
I did not try 1.5.8b
Example here


  • acrylian Administrator, Developer
    edited March 2021

    Then you should try 1.5.8 as that will be the next version soon. You always should if you encouter a bug as it might be alreadys fixed before reporting an issue. That helps us a lot. Thanks

    Last time I tried and fixed this all worked as expected.

    • What are you sorting exactly. Images within an dynamic album or albums within a dynamic album?
    • DId you clear and/or disable the search cache?
  • ctdlg Member

    I sort images within an dynamic album.
    I did clear the search cache.

    here are my alb parameters

    theme-pano-aerien is a tag - My alb albums perform tags search.
    Many images use this tag in many different albums.

    If 1.5.8 is released soon, I will wait for it !

  • ctdlg Member

    I did try 1.5.8 on Xampp (localhost, on my computer) - same problem.

  • acrylian Administrator, Developer
    edited March 2021

    We will try to reproduce this. You sort by title? Have you tried sorting by filename instead? Titles are always a bit special becaue of their array structure not matter if you use multilingual or not.

  • ctdlg Member

    Filenames I use are using codes.

    S-Img_4875-4879.jpg - I know I have used images 4875 and 4879 from my Canon Camera to produce a single stereo picture.

    P-DJI_0785.jpg means picture is a pano made by my drone camera.

    Those codes help me a lot as I use other files to display my pictures.
    Examples :
    P-DJI_0785.json will display the pano of picture P-DJI_0785.jpg,
    S-Img_4875-4879.htm will display 4875-4879 pictures in stereo mode

    And, I know I will be able to print a book with the best full resolution pictures as it will be easy to find originals !

    This is why I sort by titles.

  • acrylian Administrator, Developer

    Okay, just thought as filenames are often "reduced version" of the titles at best that would be a workaround for now.

    We are investigating the issue and so far can only reproduce that the sortorder by title within dynamic albums is always descending no matter if checked or not. This is werid as we were sure to have this generally fixed as we tested this in and out the last time…

    Also acccents and possibly other special chars seem to disturb ordering by title. so in descding order we have "P : Châtenois, 1", "P : Choiseul" although it should be the other way round…

    That is not specific to dynamic albums. We have yet to investigate further if this is a PHP core issue (text encoding stuff like this is the most fun…) or a specific ZP problem.

    We'll post here as soon as we have news.

  • ctdlg Member
    edited March 2021

    Thank you very much.

    You are right : using descending order gives me almost perfect results.
    Descending order is better than no order at all.

    I will change all my dynamic alb settings to title descending !

    There is another problem using admin page with 1.57 or 1.5.8 : I open a new subject.

    EDIT : descending order does only work on my localhost computer !
    I will compare php versions / configs and report soon.

  • ctdlg Member

    And here are my php versions

    online site
    php 7.4.14
    mariadb 10.3.27

    mariadb 7.4.15

    Could it be mariadb version ? quite often I get a new mariadb version, without requesting anything.

  • acrylian Administrator, Developer

    No, it is most certainly not the database. TItles are sorted not in the db query because they are arrays. That is the descending order always issue.

    Regarding the accents quick reseaarch tells it is related - simply put - to the locale set in PHP that causes to do wrong sorting. E.g Chinese chars will not be sorted properly if you are on a German locale. Same even with French. It's not only the locale/language setting alone.

    I had no time to do actual test yet beside some quick research. Perhaps on the weekend…

    But you can already look if you have the mbstring/multibyte extension on your server.

  • ctdlg Member
    edited March 2021

    Online site AND Xamp (phpinfo) both report

    "Multibyte decoding support using mbstring enabled "

    "mbstring.language neutral"

    "$_SERVER['HTTP_ACCEPT_LANGUAGE'] fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"

    But phpmyadmin, "serveur de bases de données" reports
    Xampp Jeu de caractères du serveur : UTF-8 Unicode (utf8mb4)
    Online site " Jeu de caractères du serveur : cp1252 West European (latin1) "

  • acrylian Administrator, Developer
    edited March 2021

    I have to review the multibyte stuff as that seems to be were the accent issue lies. "mbstring.language neutral" mayb be related. But also for such chars a specific multibyte function must be used to proper sort which we don't as far as I remember. As said no time right now to dig into it.

    Again, the database is likely not the issue as titles are not sorted in queries. Although we didn't yet switch to utf8mb4 (yeah, we are way behind but other stuff was more important) French goes well along with normal UTF8.

  • acrylian Administrator, Developer

    There is now a fix for the issue regarding ascending/descending sortorder in dynamic album in 1.5.8RC. That actually was a general oversite bug (parameter mismatch string vs boolean values) that applied to search results of all item types.

    Also if your system's PHP has the native intl PHP extension ( and its Collator class sorting titles (any multilingual content using our sortMultiArray() function) is/should now done according to the current locals. E.g. French accented chars are sorted correctly if the French locale is active . Same for German umlautes in the German locale and so on (German covers accents as well though). PHP does not do this right automatically with the standard natural order sorting.

  • ctdlg Member

    Bravo !

    I have tested locally your 1.5.8rc version (on my localhost computer using Xampp) and it does solve my problem.

    I will upgrade the online server soon.

    Thank you so much ...

  • ctdlg Member

    Online site is upgraded, and sort order problem is solved !

    So happy ! I donated again using your paypal link.
    And ready to donate again when next major update will be released.

    Zenphoto is fun to use, powerful !

  • acrylian Administrator, Developer

    Thank you, very appreciated!

Sign In or Register to comment.