Add size in Gallery Settings in Media Library

first +1 for the first commenter .
NEVER CHANGE CORE FILES.

this function will do the trick for your media upload :

function dl_custom_image_sizes_add_settings($sizes) {
       unset( $sizes['thumbnail']); //comment to remove size if needed
       //unset( $sizes['medium']);// uncomment to remove size if needed
       //unset( $sizes['large']);// uncomment to restore size if needed
       unset( $sizes['full'] ); // comment to remove size if needed
       $mynewimgsizes = array(
              "your-custom-size_name-1" => __( "Name_to_display1" ),
              "your-custom-size_name-2" => __( "Name_to_display2" ),
              "your-custom-size_name-3" => __( "Name_to_display3" )
       );
       $newimgsizes = array_merge($sizes, $mynewimgsizes);
       return $newimgsizes;
}
add_filter('image_size_names_choose', 'dl_custom_image_sizes_add_settings');

of course , this will work only if you define them first like so :

/*
Post Thumbnails Support
*/
add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts
add_image_size( 'your-custom-size_name-1', 220, 100, true ); // Permalink thumbnail size
add_image_size( 'your-custom-size_name-2', 50, 50, true ); // example home  thumbnail size
add_image_size( 'your-custom-size_name-3', 470, 350, false ); //  slider size

otherwise it will show greyed out buttons..

Leave a Comment