I have created a new image size using the add_image_size(), and I want to have it listed in the media library image size when I insert it. So I have the following code:
add_image_size( "grade-image", 320, 300, true );
function sgr_display_image_size_names_muploader( $sizes ) {
$new_sizes = array(
"0" => "grade-image",
);
/*
$added_sizes = get_intermediate_image_sizes();
// $added_sizes is an indexed array, therefore need to convert it
// to associative array, using $value for $key and $value
foreach( $added_sizes as $key => $value) {
$new_sizes[$value] = $value;
}
*/
// This preserves the labels in $sizes, and merges the two arrays
$new_sizes = array_merge( $new_sizes, $sizes );
return $new_sizes;
}
add_filter('image_size_names_choose', 'sgr_display_image_size_names_muploader', 11, 1);
however, it does not show the grade-image size. I tried the commented block to show a list of all image sizes, and it does show some of the other image sizes, but not the grade-image one. I'm really puzzled.