WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 20 months ago

Last modified 18 months ago

#21643 closed defect (bug) (duplicate)

Uploaded media should keep alphabetic order

Reported by: 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 20 months ago.
Step #1 of upload process: media displayed in correct order
upload-step-02.png (87.1 KB) - added by tar.gz 20 months ago.
After the upload: still displayed in correct order.
upload-step-03.png (86.5 KB) - added by tar.gz 20 months ago.
After saving: the files are now in reverse-alphabetic order.
keep-alphabetical-order.php (765 bytes) - added by SergeyBiryukov 20 months ago.

Download all attachments as: .zip

Change History (16)

tar.gz20 months ago

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

tar.gz20 months ago

After the upload: still displayed in correct order.

tar.gz20 months ago

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

comment:2 tar.gz20 months ago

Another user even produced a screencast that shows the issue:

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

comment:3 tar.gz20 months ago

  • Component changed from General to Upload

comment:4 SergeyBiryukov20 months 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 20 months ago by SergeyBiryukov (previous) (diff)

comment:5 nacin20 months 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.

comment:6 tar.gz20 months 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

comment:7 SergeyBiryukov20 months 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 20 months ago by SergeyBiryukov (previous) (diff)

comment:8 follow-up: tar.gz20 months 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.

comment:9 SergeyBiryukov20 months 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.

comment:10 in reply to: ↑ 8 ; follow-up: azaozz20 months 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.

comment:11 in reply to: ↑ 10 tar.gz20 months 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.