Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 4 years ago

#18520 closed enhancement (fixed)

Allow addition of image sizes in Thickbox via filter

Reported by: alexkingorg's profile alexkingorg Owned by: azaozz's profile azaozz
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: Media Keywords: has-patch
Focuses: Cc:


Plugins and themes can register new image sizes, but these don't appear in the media lightbox (#15668).

The right thing to do might be to add a param to add_image_size() that tells it if the image size should be included in the media lightbox (because you definitely don't want to auto-add them all). However, this would be a rather invasive change which would alter the data in global $_wp_additional_image_sizes and may introduce bugs.

Perhaps an easier approach is just to add a hook (patch attached).

If there is consensus that an additional parameter to add_image_size() and automatically displaying those sizes in the media lightbox, I can put together a patch for that too.

Attachments (3)

patch.diff (677 bytes) - added by alexkingorg 13 years ago.
Allow image sizes to be filtered into media lightbox. (47.1 KB) - added by alexkingorg 13 years ago.
Add filter and update CSS to better allow customization
patch-w-css-dev-only.diff (2.5 KB) - added by alexkingorg 13 years ago.
Same patch, but only changing .dev files (much more readable)

Download all attachments as: .zip

Change History (10)

13 years ago

Allow image sizes to be filtered into media lightbox.

#1 @alexkingorg
13 years ago

Once we allow additional sizes to be filtered in, the UI needs a little revision as well. The alignment options need to be moved flush left (to match the rest of the fields) and the different sizes need to be presented in a vertical list instead of floated. Here are screenshots for demonstration purposes:

We trade a touch of vertical hight for the default case to be able to better accomodate customization. A reasonable trade IMO.

I've attached a patch that includes the CSS changes needed for this (along with the filter addition).

13 years ago

Add filter and update CSS to better allow customization

13 years ago

Same patch, but only changing .dev files (much more readable)

#2 @Otto42
13 years ago

At some point, that lightbox starts getting too large. I have no problem with allowing additional sizes in there, but maybe a different UI idea is needed there. What happens when a theme puts in like 15 image sizes (and don't think they won't).

#3 @azaozz
13 years ago

  • Owner set to azaozz
  • Status changed from new to reviewing

Agree that adding a filter on the selectable image sizes seems the better option. We are attempting to change the layout of the Media Library popup and do away with Thickbox but will always need plugins control on the image sizes available for insertion into the post by the user.

@Otto42 yes, I'm sure some plugins will do some crazy things in there, but I've seen crazy things done with the media library popup right now too :)

#4 @alexkingorg
13 years ago

My goal is to allow users to easily use the sizes that the themes/plugins create that will best match their display needs. I'm not trying to favor any specific implementation, this just seemed like the lowest hanging fruit.

Otto, you did see the screenshots where I reconfigured the UI a little to allow for more sizes to be listed in a slightly cleaner way?

Getting rid of the pop-up in favor of a better media integration sounds great to me.

#5 @azaozz
13 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In [18802]:

Add filter so the users can select custom image sizes added by themes and plugins, props alexkingorg, fixes #18520

#6 @SergeyBiryukov
13 years ago

  • Milestone changed from Awaiting Review to 3.3

This ticket was mentioned in Slack in #core-editor by wingo5315. View the logs.

4 years ago

Note: See TracTickets for help on using tickets.