Uploading images in order of filename

Is it possible to have images that are uploaded & inserted into a post to appear in order by filename?

For example: if I select the following images (1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg) on my computer & upload them into a post (using the editor’s file upload icon) they seem to be inserted in a random order (it’s not by filename or size). This makes inserting images into “How To” posts or tutorials or anything where a timeline needs to be preserved very tedious because images would have to be inserted one at a time in order to preserve the coherency of the post.

Is this a CP setting I’ve missed or just the way things are?

4 Likes

Interesting use case, I think it is a reasonable feature request to sort by name if you are trying to upload multiple things. Though I wonder “if this is the correct default” why is the operating system not taking care of it?

Hi @sam, I’m not sure what you mean by that.

Here’s another example of what I’m trying to explain: if I use my camera to take pics during a 7 day motorcycle ride, all those pics will be sorted by filename (DSC_001, DCS_002, etc.) which presents the chronological order the pics were taken. What I’d like to see is simply for that order to be preserved when selecting those pics & uploading them into a post.

I mean. We are not getting the filenames in random order, we are getting them in the order the operating system supplies them to the web browser.

Here I have selected pics 1.jpg thru 5.jpg & uploaded them to this post:

1

3

4

5

2

What order did you click on the files in the operating system. Let’s try a test:

Here’s me clicking on 1.png, then 2.png, then 3.png, in that order, and uploading them:

1 2 3

Looks in order to me…

Let me try again with different images, and I’ll click on them in reverse order, 3.jpg2.jpg1.jpg

jpg_fixed jpg_fixed jpg_fixed

Not entirely sure what happened there, that looks like 2, 1, 3 to me.

Ok, I can understand that. Is there any way to uhhhh change this?

I suggest starting by putting just the target images in a folder by themselves to test.

I select 1.jpg then hold shift & select 5.jpg.

That is usually the case. For example there’d by a GoPro folder with a bunch of images sorted by filename (and thus by timestamp). Selecting 20 images to create a ride report for a multi day ride doesn’t yield the correct chronological order where one could simply add a gap between each image & enter whatever relevant text applies then move on to the next image.

Every image would need to be inserted one. at. a. time.

Let me try shift-selecting all images in this folder. Here goes, shift-select the range… wait, I already see a problem! Note the circled area in the screenshot:

Now let me try again shift+clicking each one… wow nope! No change! Windows apparently really wants those files sent in that weird order, maybe it’s a “human sort” issue? Let me try renaming them… wow! Nope!

Note the filename area again ↑ ↑

:rofl: here’s what works. Click the files you want to upload in reverse order of number. Therefore I am shift-clicking 8, 7, 6, 5, 4 and I get…

Which looks good, and when uploaded…

jpg_fixed jpg_fixed jpg_fixed jpg_fixed jpg_fixed

Upload also looks good. So this is definitely an operating system / browser issue, nothing to do with Discourse.

2 Likes

A pop instead of a shift so the indexes don’t need to be revised?

Hi @codinghorror, I didn’t mean to imply it’s an issue with Discourse. Is there a possible “fix” from the Discourse side of things where attachments could be displayed in order of filename? Apologies if I’m asking for the moon here – it’s just my ignorance talking.

The “fix” is to shift or ctrl click on the files in the correct order as determined by your operating system :wink:

See my screenshots ↑

Yes, I fully understand that. I can tell my users to shift-click & (hopefully) remember to select images in a backwards oder, but I was hoping maybe Discourse could handle this automagically in a future update.

Discourse is handling the files in the correct order that the operating system and browser is passing them to Discourse.

You may wish to file a bug with your OS vendor.

Already on that. Would you suggest starting with “Hey Tim” or “Dear Mr. Cook”?

It’s interesting that both Apple and Microsoft have this weird behavior, isn’t it?

I agree that it is totally bizarre that the OS wouldn’t respect the order in which you clicked or selected the files.

Now that I think of it, I notice the same behaviour when copying files to my NAS. If I select an album folder with a bunch of MP3 files (01 - song title.mp3, 02 - song title.mp3, etc.) they also seem to “land” on the server in random order.

Could it be the browser and not the OS?