Hi @chrislowrance ,
Thanks for the clear example.
You’re right, and this one is on us, not on your settings.
When you sort a gallery by title, NextGEN Gallery hands the job to the database, which compares titles one character at a time. It reads “1” before “2”, so “Img10” lands ahead of “Img2”. It never sees “10” as the number ten. The same thing happens if you sort by filename instead.
I went through the code in 4.2.3 and in every earlier release we have on hand, back to 3.59, and it behaves identically in all of them. So nothing changed recently on your site. Your memory of the old behavior is right, though. NextGEN Gallery really did use natural sorting, but that was in versions 1.9.9 and 1.9.11, back in 2012 and 2013. It was lost during the 2.0 rewrite when sorting moved into the database query, and no changelog entry ever recorded it going away.
I’m sorry it isn’t the quick fix you were hoping for. The sort runs in the database before the gallery gets split into pages, so we can’t just reshuffle the images afterward, and there’s no setting or filter that changes it today. I’ve written it up for our developers as a request to bring natural sorting back as its own sort option.
What you can do now
The fastest fix is to pad the numbers with zeros, so alphabetical order and numeric order line up:
Img001.jpg, Img002.jpg, Img010.jpg, Img100.jpg
Use as many digits as your largest number needs. Three digits covers you up to 999. Once the titles are padded, sorting by “Alt/Title text” gives you the order you expect, and it keeps working for galleries you add later.
If you’d rather not rename anything, set a manual order instead:
- Go to “Imagely > Settings” and open the “Image Options” tab.
- In the “Gallery Sorting” section, set “Sort galleries by” to “Custom order”.
- Open a gallery under “Imagely > Gallery”, drag the thumbnails into the order you want, and save your changes.
Custom order is respected everywhere, so this holds on the front end. The trade-off is that you set it per gallery by hand.
I apologize that we can’t provide what you’re looking for right now, but I appreciate the suggestion and any other details you may be able to provide! It’s always helpful to get insights from our users.
Best,
Mihai