I would like to create an additional size for uploaded images which my users can then “insert into post”. I understand that add_image_size() will add a new image size which I can use in my theme, but that new size isn’t available on the media upload screen.
Is there a way to get new sizes to appear on that screen so they’re available to people as they add/edit posts? I have a tweaky theme that needs more than just the default 3 sizes + original.
Thanks!
Just found a new plugin which seems to do exactly what I described above:
http://wordpress.org/extend/plugins/additional-image-sizes-zui/
Hope this helps someone!
Even though we create our image size we will need additional code to add it into the Media Uploaders dropdown of available sizes. First let’s register the size. We can use the
init
orafter_setup_theme
hook:We need to use the
image_size_names_choose
hook to add in the new size into the available sizes. The Developer Resources suggests using the following:The above works fine but maybe we can automate this a bit. The below assumes that any additional sizes are named with underscores so it may not be an optimal solution that works with plugins that add their own sizes. It is also heavily commented to show what each variable is.
I cracked open the code and there doesn’t seem to be a way to do this.
The list of thumbnail sizes that WP iterates through while rendering those radio buttons is hard-coded, and there don’t seem to be any filters or actions to hook in to.
This is really strange. I’d fully expect there to be a way to do this.
Do people need to be able to insert ANY of your custom sizes into posts at any given time? Or are some of them only used in templates? I guess what I’m asking is, is it possible to just make one or more of the default sizes (thumb, medium, large) the ones that get added in posts, and save any additional versions for custom sizes? Know what I mean?