Media sorting
-
Your plugin does media filtering very well! Thank you! Does it support media sorting in the Insert Media model?
WordPress offers rudimentary sorting (manual drag and drop) but no advanced sorting by file name, date, id, or otherwise.
For example: Images uploaded to the WordPress media library and inserted into a post immediately after uploading are displayed in a desirable ascending order; the image order is reversed if those images are selected from the media library (having already been uploaded).
-
Thanks for the good words and for this question.
The current MLA version does not include any sorting features specific to the Media Manager and its Modal Window. I might consider adding something in a future version, but I’d like to know a bit more about what you want.
I can think of two types of sorting in the Modal Window. First, sorting the set of thumbnails in the middle of the window; the files you click on to choose items. Second, sorting the items at the bottom of the Create Gallery window; the files that will be added to the
[gallery]shortcode on the post or page. Which of these two sorting applications are you asking about?When you say “(manual drag and drop)” it sounds like you are asking about the
[gallery]items.I am not sure I understand your example. When you say “inserted into a post” do you mean IMG tags in the body of the post or items in a
[gallery]? Are you referring to the order in the middle of the Modal Window when you pick “Uploaded to this post” from the dropdown in the upper-left corner of the window?If you can give me more details it will help me think through what I can do to help. Thanks for your interest and your understanding.
Hi David, thanks for your swift response. I’ll follow up with clarifying details.
These screen captures show the WordPress default sorting behavior with uploaded images and images selected from the media library.
Ideally, I think custom sorting should occur alongside your filtering and search tools.
I personally would enjoy sorting by EXIF/IPTC meta data like the image capture date/time, but that is more complicated functionality than I truly need. A simple timestamp or filename sort with ASC/DSC options would suffice.
Regarding the Gallery, WordPress offers a “reverse order” button that isn’t present for inserting individual media items.
This is most helpful; thanks for taking the time to post the annotated screen shots.
Actually, the “WordPress default sorting behavior” is based on how you click on the images you want. For example, if you hold down the Control key (Windows PC) and click randomly on images in the window they are added to the list in the order clicked. If you click an image, then hold down the shift key and click another image you get all the images in between the two in the order that they have in the window (left to right, top to bottom).
As you observed, the “ascending” order you want is an artifact of the drag-and-drop file uploading process; there’s no way to duplicate it once the files are in the Media Library.
The easy fix, when you’re selecting from the Media Library, is to hold down the control key (or the Mac equivalent) and click the images in the order you want.
Sorting all of the files that appear in the middle of the Modal Window is more difficult. The files you see are a subset of the files in the Media Library; the Media Manager requests them in “pages” of forty images at a time and caches them in the browser. As you scroll down, more images are fetched from the server and added to the cache. Resorting the files you see would require clearing the cache and starting over. That’s possible, I believe.
The screen real estate required to add sorting to the Modal Window Toolbar is another issue. I have already had comments that this area is too crowded to begin with, especially for mobile devices. Of course, any sorting controls could be suppressed by a Settings option.
Another alternative would be to add a server-side Setting to specify the sort order for Modal Window items, as you can do now for the Media/Assistant submenu table. Would changing the default order (but not adding controls to the Modal Window itself) be useful?
I will continue to reflect on this, and I welcome any additional thoughts you have on the subject. Thanks again for a stimulating suggestion.
Clicking the images in the order I wish them to appear is a workable solution. It does become tiresome as the number of images increases.
WordPress queries the media library database entries and sorts them in some way. Can you intercept the query with a custom sorting value? Sure… having this set in the plugin settings would be okay.
Maybe the best place for client-side image sorting is in the lower queue instead of the media browser. Do you think there is room for a “reverse order” toggle of some kind?
I’m glad the “clicking order” technique gives you some relief.
Yes, the plugin can “intercept the query with a custom sorting value“. In fact, that’s how MLA provides support for filtering the images by taxonomy term in the current version. Adding sort criteria on the server side, based on a settings option, should be straight forward.
I can look at adding something to the lower queue. This would be on the browser side, requiring JavaScript coding that interacts with the Modal Window code in the Media Manager. I have found that to be a real challenge (as have other plugin authors).
I will see what I can do. Thanks again for thinking this through with me.
I have done some work on this and I regret to report that the Media Manager will re-sort the items supplied by the server back to the default “date, descending” order. This is part of the Media Manager’s caching and incremental retrieval logic and I can see no way to extend it to other sort orders.
Until the Media Manager is re-worked to allow modification of this kind, you will have to live with the default functionality.
I am going to mark this issue resolved because there is nothing MLA can do to help. I regret that the news isn’t better; thanks for your understanding.
The topic ‘Media sorting’ is closed to new replies.