Add media library column with image width and height

Adding this snippet to the functions.php of your wordpress theme will add a new column to the media library that will display the images width and height.

 

 

function wh_column( $cols ) {
$cols["dimensions"] = "Dimensions (w, h)";
return $cols;
}
function wh_value( $column_name, $id ) {
$meta = wp_get_attachment_metadata($id);
if(isset($meta['width']))
echo $meta['width'].' x '.$meta['height'];
}
add_filter( 'manage_media_columns', 'wh_column' );
add_action( 'manage_media_custom_column', 'wh_value', 10, 2 );

Leave a comment