KC Media Enhancements

Not so long ago I’ve blogged about adding some enhancements to WordPress media management, such as inserting images with custom sizes into post and setting terms for the attachments along with individual plugins for each functionality. When I released the KC Widget Enhancements plugin, I thought I should combine those plugins into one package too. So now I present it: KC Media Enhancements.

Update
The plugin is now hosted at WordPress Plugin repo. Enjoy πŸ™‚

This plugin currently provides you with the two functionalities mentioned above which you can enable/disable easily if you have KC Settings plugin installed. You can also modify the options using the available kcme_options filter (please read the FAQ section in the readme.txt file on how to do this).

The plugin is currently hosted at GitHub and will always be updated there, but it’s also in the process of approval to be hosted at WordPress plugin repo and I will update this post as soon as it’s approved and hosted there.

Enjoy the plugin and feel free to leave a comment/bug report/ideas in the comments section below πŸ™‚

Standard

Insert Image with Custom Size into Post

Since version 2.9, WordPress provided a new function, add_image_size() to define additional image sizes along with the three default sizes: Thumbnail, Medium and Large. After defining the additional sizes, we can use them in our themes either using the_post_thumbnail(), wp_get_attachment_image(), or any other functions that suit your needs.

Update
I’ve created a plugin for this so you won’t need to edit your theme/plugin files anymore πŸ™‚ Download it from WordPress plugins repo.

function my_insert_custom_image_sizes( $sizes ) {
  global $_wp_additional_image_sizes;
  if ( empty($_wp_additional_image_sizes) )
    return $sizes;

  foreach ( $_wp_additional_image_sizes as $id => $data ) {
    if ( !isset($sizes[$id]) )
      $sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );
  }

  return $sizes;
}
add_filter( 'image_size_names_choose', 'my_insert_custom_image_sizes' );

The result

Note: The new code is adapted from here.

Standard