Uploading images in order of filename


#1

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?


(Sam Saffron) #2

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?


#3

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.


(Sam Saffron) #4

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.


#5

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

1

3

4

5

2


(Jeff Atwood) #6

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.


#7

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


(Jeff Atwood) #8

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


#9

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


#10

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.


(Jeff Atwood) #11

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.


(Mittineague) #12

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


#13

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.


(Jeff Atwood) #14

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 ↑


#15

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.


(Jeff Atwood) #16

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.


#17

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


(Jeff Atwood) #18

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.


#19

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.


#20

Could it be the browser and not the OS?