Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#21643 closed defect (bug) (duplicate)

Uploaded media should keep alphabetic order

Reported by: targz's profile tar.gz Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Upload Keywords: close
Focuses: Cc:

Description

When dragging a bunch of files on the "Drop files here" upload field, one would expect that they are automatically ordered by their filenames. In the case of photos taken by a digital device, this would mostly get them in chronological order.

Strangely, WordPress is reverting this order when saving.

What we observe:

  • During the upload process, the files are displayed in alphabetic order.
  • After clicking "Save all changes", we are presented with the media gallery view: the order is now reverted.

If we want to put them in the correct, alphabetic order, we need to click the "Sort Order > Descending" link, and save. This isn't very intuitive.

Attachments (4)

upload-step-01.png (57.8 KB) - added by tar.gz 12 years ago.
Step #1 of upload process: media displayed in correct order
upload-step-02.png (87.1 KB) - added by tar.gz 12 years ago.
After the upload: still displayed in correct order.
upload-step-03.png (86.5 KB) - added by tar.gz 12 years ago.
After saving: the files are now in reverse-alphabetic order.
keep-alphabetical-order.php (765 bytes) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (16)

@tar.gz
12 years ago

Step #1 of upload process: media displayed in correct order

@tar.gz
12 years ago

After the upload: still displayed in correct order.

@tar.gz
12 years ago

After saving: the files are now in reverse-alphabetic order.

#2 @tar.gz
12 years ago

Another user even produced a screencast that shows the issue:

http://www.youtube.com/watch?v=9ljUBpWpaZM

#3 @tar.gz
12 years ago

  • Component changed from General to Upload

#4 @SergeyBiryukov
12 years ago

  • Keywords close added

After saving: the files are now in reverse-alphabetic order.

The order in both Gallery and Media Library tabs is not alphabetic at all, it's by upload time, descending (same as the order on Media Library screen and the order of blog posts by default).

Last edited 12 years ago by SergeyBiryukov (previous) (diff)

#5 @nacin
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Either way, #21390 will likely improve the UI for this pretty significantly.

#6 @tar.gz
12 years ago

Thanks Sergey and Nacin for the comments.

Just to explain it better, from a user perspective the problem is:

1) During the upload/crunching step, the interface shows the files in the correct (ascending?) order: 001.jpg, 002.jpg, 003.jpg. The user thinks "perfect, I can just save and all is fine".

2) After hitting "Save all changes", the order has been reversed to "003.jpg, 002.jpg, 001.jpg" (descending). The user thinks "WTF? first it was correct, now the order is wrong".

When uploading in bulk, there is no way for the user to control the "upload time" order - for the user it's simultaneous.

I just made a 40-second video so you can see the process:
http://sandbox.4o4.ch/wp/wordpress-upload.swf

#7 @SergeyBiryukov
12 years ago

Yes, I see what the issue is.

However if a user uploads a second bunch of images, it will be displayed on top of the previous one, which might also be confusing.

I guess the actual enhancement here would be to switch from sorting by ID (which depends on the order of uploading) to alphabetical order in the Gallery tab. This wouldn't be the default behaviour, but makes sense as a plugin.

keep-alphabetical-order.php is a workaround plugin for that.

Last edited 12 years ago by SergeyBiryukov (previous) (diff)

#8 follow-up: @tar.gz
12 years ago

Thanks a lot for that plugin, Sergey ! It's already a huge improvement for me. What I like is that the listing order seen during the upload is maintained after I hit "save".

But indeed, it's probably confusing when the user adds more images in a second step.

I think that the behavior of multiple image upload as it is currently handeld in Facebook (for image "albums") is probably the most intuitive and useful:

1) If you upload a bunch of images (e.g. 004.jpg, 005.jpg, 006.jpg), they will be ordered by filename.

2) If you upload a second bunch of images (e.g. 001.jpg, 002.jpg, 003.jpg), they will also be ordered, BUT they will be added AFTER the previously uploaded ones (at the bottom).

So the end result of that example would look like this:

  • 004.jpg
  • 005.jpg
  • 006.jpg
  • 001.jpg
  • 002.jpg
  • 003.jpg

So the rules for Facebook albums are:

  • Each group of uploaded files is ordered alphabetically.
  • New groups of uploaded files are added at the end of the list.

While in WP 3.4 the result looks like this:

  • 003.jpg
  • 002.jpg
  • 001.jpg
  • 006.jpg
  • 005.jpg
  • 004.jpg

So we can observe the following rules in WP 3.4:

  • Each group of files is ordered "by upload order, newest first" (which happens to be reverse-alphabetical most of the time).
  • New groups of uploaded files are added at the beginning of the list, since they have a newer file ID.

I'm pretty sure that in 90% of cases, that won't be the "right" order, and the user will have to change it manually.

Finally, with Sergey's modification, the end result is this:

  • 001.jpg
  • 002.jpg
  • 003.jpg
  • 004.jpg
  • 005.jpg
  • 006.jpg

So here the behaviour is:

  • Each group of files is ordered alphabetically.
  • New groups of uploaded files are not handled as "groups" at all, they are forced into the alphabetical listing.


I believe that the way Facebook handles multiple image uploads is the most user-friendly and coherent (I hope they don't hold a patent on this?:). If we want to achieve it in WP, we could apply the following logic:

  • By default, file galeries are ordered from the oldest to the newest ID (oldest on top).
  • When a group of files is bulk-uploaded, IDs are given to the files by alphabetical order.

#9 @SergeyBiryukov
12 years ago

With the current UI, ascending order in galleries might result in more scrolling to see the newly added files. Let's see if #21390 improves the workflow.

#10 in reply to: ↑ 8 ; follow-up: @azaozz
12 years ago

Replying to tar.gz:

It's not that simple.

When uploading multiple images the upload order also depends on how the image files are displayed and sorted in the OS (top to bottom and left to right). A much better sort order for photos/JPEGs would be by the EXIF creation date. That should probably be the default sort order for galleries.

#11 in reply to: ↑ 10 @tar.gz
12 years ago

Replying to azaozz:

When uploading multiple images the upload order also depends on how the image files are displayed and sorted in the OS (top to bottom and left to right).

Indeed, this influences the order in which the files are sent from the OS to the browser. I assume that many people have their GUI sorted by file name, with 001.jpg on top and 006.jpg on bottom. That explains why the 001.jpg is received "first" by WP, and ends up at the bottom with the current system.

A much better sort order for photos/JPEGs would be by the EXIF creation date. That should probably be the default sort order for galleries.

Maybe, but we must also assume that many images are stripped of EXIF information. Since our digital cameras today are taking pictures in the 15-20 megapixel range, people will often resize them in a batch operation before uploading them. During that operation ("save for web"), the images typically loose the EXIF data but keep the same file name (and they may have their time stamps reverted, or put in random order...). So when there is no EXIF information, the sequential numbering of the files seems to me the most reliable way of figuring out the "correct" order.

PS: I notice that there's a discussion about the media management overhaul going on at make.wordpress.org/ui, so I propose that we continue the discussion there, as long as we aren't contributing patches.

Note: See TracTickets for help on using tickets.