How to re-sort (order) a collection FAST?


let’s take this as example:

I’m uploading 100 images named “myimage-00.jpg” up to “myimage-99.jpg” into a folder.
I select all images and adding them to a collection.
Within the collection, the images are NOT sorted (ordered) by name, they seem to be randomly sorted.
I could use the up/down arrows to sort them correctly, but you may know, this could take HOURS.

My question: How to order the images within a collection FAST?
An SQL statement (to call externally, eg via phpMyAdmin) would help also!

p.s.: If you’re asking WHY I want that: When getting collection data via API, the sort order of the collection is important, because I want to show 00.jpg image first, 01.jpg second and so on.

Your question is a bit confusing. You refer to “up/down” arrow buttons (no
idea what this is as we don’t have that in our UI) and then the API. The
API itself returns the records unsorted. You can sort them yourself in your

Dear Nitai,

this is very, very, VERY weird to me when you don’t know about the very basic functionality of your product!?

You even have fixed a bug according to this sort order last year:

I made 2 screenshots. You see up/down arrows to arrange the sort order of the picture within a collection.

The other screenshot shows the database table (mysql, table: raz1_collections_ct_files ) where the sort order is stored.
As far as I know, the API is returning a collection according the sort order.

Now back to my inital question!
The images within the collection are sorted randomly when adding them into the collection. I could use these up/down arrows, but that function is sluggish and only useful with collection <10 images.
So, I want to have the order in raz1_collections_ct_files table according to the filenames - ascending.

I could use a “simple” update sql statement, a function or whatever.

And please let me recommend to extend the API - add a “sort_order” field for output. See this:

Method: getassets
Input parameters: api_key, collectionid, sort_order (new)
=> sort_order could have e.g. “collection_order” (like now), “filename”, “date” etc.

I mean, such a feature would be easy to implement just by adding a “sort by col_item_order ASC” or similar entries. Well, it may take a day, but hey, just a day for such a great feature? :slight_smile:

Hopefully you (or someone else) could help me out with this.

As mentioned in my original answer to you, your initial question was confusing and I did not know what section or UI you are referring to. I don’t see a reason why you would questioning me, when your initial message was confusing.

That said, this is an open source system. If you want to change something, please go ahead and do it. As it apparently is so easy and only takes a day, I’m sure your time is well invested.