Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
JMM
Experienced
Topic Author
Posts: 154
Joined: 02 Aug 2021, 11:18

With Name selected for sort order, X3 not sorting all images by name alphabetically

01 Aug 2023, 06:30

Hello, Karl,

I am having a bugger of a time sorting images in my galleries.  First of all, on the Settings tab, I am using Justified layout, and on the Gallery tab I am sorting by Name, ascending.  On the Gallery tab, I am sorting my images listing by Name.

I have my images grouped (by way of my filenames), with xxx~0000000000000.jpg always displaying first, followed by xxx~0000000000000~profile.png
always heing the 2nd file displayed in each group, then followed by the actual images.

When I look at my files in Windows File Explorer, they show up in the correct order... for example:
Code
groupname1~0000000000000.jpg
groupname1~0000000000000~profile.png
groupname1~0b9d98044419e03d.jpeg
groupname1~02d07f5062eca009.jpg
...however, for some reason, X3 is displaying the files in this incorrect order (on both the Gallery page and also on the public site):
Code
groupname1~0b9d98044419e03d.jpeg
groupname1~0000000000000.jpg
groupname1~0000000000000~profile.png
groupname1~02d07f5062eca009.jpg
For another group, in Windows they show in the correct order:
Code
groupname3~0000000000000.jpg
groupname3~0000000000000~profile.png
groupname3~0c75b45e66e582f9.jpg
groupname3~0e8da16b818ea63f.jpg
groupname3~0fa3c20f89b65596.jpeg
groupname3~2d825276f52b3421.jpeg
...however, X3 is displaying the files in this incorrect order (on both the Gallery page and also on the public site)::
Code
groupname3~0c75b45e66e582f9.jpg
groupname3~0e8da16b818ea63f.jpg
groupname3~0fa3c20f89b65596.jpeg
groupname3~0000000000000.jpg
groupname3~0000000000000~profile.png
groupname3~2d825276f52b3421.jpeg
I thought that it might be because of the quantity of zeros that I had, but when I increased them to be the same number of characters as the actual filenames, the sort order in X3 was still messed up:
Code
groupname3~0c75b45e66e582f9.jpg
groupname3~0e8da16b818ea63f.jpg
groupname3~0fa3c20f89b65596.jpeg
groupname3~0000000000000000.jpg
groupname3~0000000000000000~profile.png
groupname3~2d825276f52b3421.jpeg
In order for me to come up with a naming convention for the first 2 files in each group, any suggestion as to what I could name the first 2 files so that they always in X3 show up ahead of the remaining images in each group?

Thank you in advance.

Regards,
John
Location: Burlington (Toronto-ish), Ontario, Canada
Self-hosted using Abyss Web Server:   AuroraWings.me   |   GalleryWings.com   |   PanAurora-Studio.com   |
Externally-hosted using LiteSpeed/Apache Web Server:   GenealogyWings.com/galleries   |
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: With Name selected for sort order, X3 not sorting all images by name alphabetically

01 Aug 2023, 23:11

I would certainly say you have knack for pushing something to the breaking point, in this when you are challenging naming conventions across different platforms by using names like "0000000000000000.jpg" and "0000000000000000~profile.png". If you are naming files manually in the first place, then surely it makes more sense with 1.jpg 2.jpg, or 0001.jpg 0002.jpg? Simple solutions to get correct sorting.

First of all, where in the rule book does it say that "0000000000000000.jpg" should come before or after "0000000000000000~profile.png"? It would be based on some secondary rules depending on the platform (eg server, browser, desktop). Add a 1 there with the zero's, and you have consistent and logical sorting. Then there is alphanumerical sort vs "human" sort factors ... For example, what comes first of "2.jpg" and "10.jpg"? In normal order, 10.jpg will come first, because "1" is before "2", although humans will like to think 2 comes before 10. This varies across sorting mechanisms.

Then of course, I should mention there is already "Custom sort" option in X3, especially meant for when your images are not properly sorted by file name. This should really be the answer to your question.
groupname1~0000000000000.jpg
groupname1~0000000000000~profile.png
groupname1~0b9d98044419e03d.jpeg
groupname1~02d07f5062eca009.jpg
It seems this extreme naming convention is created because you already have loads of files that start with "0" and you don't want or can't rename them?

Thing is, I could do some tests and study exactly why X3 differs slightly, but in the end this is PHP and your server.

The simple solution would be to use a logical name sorting convention for alphanumerical sorting, or use custom sorting. If someone asked me how the items would sort (on any system), I probably couldn't even answer without testing. It definitely looks more correct in your Windows, but if PHP sorts like that, then something from groupname1~0* is triggering it.
 
User avatar
JMM
Experienced
Topic Author
Posts: 154
Joined: 02 Aug 2021, 11:18

Re: With Name selected for sort order, X3 not sorting all images by name alphabetically

02 Aug 2023, 01:58

The simple solution would be to use a logical name sorting convention for alphanumerical sorting, or use custom sorting.
The files that I'm acquiring have filernames such as 0b9d98044419e03d.jpg... it is not me making up the filenames.  Yes, I have thought about going with Custom sort order, but that will require me manually sorting almost 500 images  :upside_down:.

I have created a test gallery HERE, to illustrate my problem.  I am trying to group the images together in the gallery, so I preceed their filenames with the manufacturer and model, so the above 0b9d98044419e03d.jpg image would become airbus~~a320~0b9d98044419e03d.jpg , and all images in that group (model) would have airbus~~a320~ preceding their filenames.

It seems this extreme naming convention is created because you already have loads of files that start with "0" and you don't want or can't rename them?
For the grey images that display the aircraft models & the divider images (with the arrows), I name them with those 16 zeroes, to keep the filename lengths the same, but that doesn't help.

And I am NOT blaming X3 for this problem, or PHP, or Windows, etc... I'm just trying to understand what is causing this problem, so I can come up with a naming convention or something else so that X3 will display the images alphabetically, which is what sorting by name implies.

In the above test gallery, the 1st image should be the grey model image with Airbus A320 on it (filename: airbus~~a320~0000000000000000~model.png), however, X3 is displaying airbus~~a320~0b9d98044419e03d.jpg first.

I've tried, for example:
airbus~~a320~0000000000000000~model.png
airbus~~a320~0b9d98044419e03d.jpg
airbus~~a320~02d07f5062eca009.jpg

and
airbus~~a320~0~model.png
airbus~~a320~0b9d98044419e03d.jpg
airbus~~a320~02d07f5062eca009.jpg

and
airbus~~a320~a~model.png
airbus~~a320~0b9d98044419e03d.jpg
airbus~~a320~02d07f5062eca009.jpg

But regardless what I try, X3 always displays airbus~~a320~0b9d98044419e03d.jpg as the 1st image of that group.

I've also tried the following, but they're still not displayed in the correct order:
airbus--a320-0000000000000000-model.png (with dashes)
airbus__a320_0000000000000000_model.png (with underscores)
Location: Burlington (Toronto-ish), Ontario, Canada
Self-hosted using Abyss Web Server:   AuroraWings.me   |   GalleryWings.com   |   PanAurora-Studio.com   |
Externally-hosted using LiteSpeed/Apache Web Server:   GenealogyWings.com/galleries   |
 
User avatar
JMM
Experienced
Topic Author
Posts: 154
Joined: 02 Aug 2021, 11:18

Re: With Name selected for sort order, X3 not sorting all images by name alphabetically

02 Aug 2023, 02:24

OK, disregard this sort problem... I've come up with a work-around as displayed HERE, by adding another layer in the naming convention (a~ for the image with the arrows, b~ for the image with the model, and c~ for all the actual images):
Code
airbus~~a340~a~divider.jpg
airbus~~a340~b~model.png
airbus~~a340~c~0c3b1a388d4cea21.jpg
airbus~~a340~c~1c82f4b988ba0cf3.jpg
airbus~~a340~c~2ca258c946e513dc.jpg
airbus~~a340~c~04f992ea654148e9.jpg
No idea why that last one, with the first character after the ~c~ being a 0, is not further up either above or below the other image with the first character after the ~c~ being a 0 (which clearly shows that sorting by name is not working in X3), but I can live with that inconsistency  :sunglasses:.

..., but in the end this is PHP and your server.
My PHP is 8.2.7, but I also downgraded to 7.4.0 a few minutes ago for a test, but the sort order was still incorrect.

Anyway, I'm happy with my work-around.  Thanks anyway.
Location: Burlington (Toronto-ish), Ontario, Canada
Self-hosted using Abyss Web Server:   AuroraWings.me   |   GalleryWings.com   |   PanAurora-Studio.com   |
Externally-hosted using LiteSpeed/Apache Web Server:   GenealogyWings.com/galleries   |