-
AuthorPosts
-
September 20, 2019 at 2:25 pm #1140228
Hello to all,
Is it possible to display image size and weights in media library screen ?
Regards,
Iceman.
September 20, 2019 at 5:22 pm #1140256Hey ICEMAN,
This is more of a WordPress function not the theme. You would need to see if any plugins are available that may provide this function.
Best regards,
Jordan ShannonSeptember 21, 2019 at 7:40 am #1140407Ok Jordan I understand.
Thank you for your answer.
RegardsSeptember 21, 2019 at 9:10 am #1140428if you are satisfied with w x h info there is a little snippet for child-theme functions.php:
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 );
you can see then in list-view the width and height of the images
September 21, 2019 at 9:40 am #1140430Thank you Guenni007, it’s nice of you. It’s work perfectly !
Regads
IcemanSeptember 21, 2019 at 9:54 am #1140431or if you like to have file-size aswell and dimensions:
delete the above snippet and add:
add_filter( 'manage_media_columns', 'media_columns_filesize' ); function media_columns_filesize( $posts_columns ) { $posts_columns['filesize'] = "File Size"; $posts_columns["dimensions"] = "Dimensions (w, h)"; return $posts_columns; } add_action( 'manage_media_custom_column', 'media_custom_column_filesize', 10, 2 ); function media_custom_column_filesize( $column_name, $post_id ) { if ( 'filesize' !== $column_name ) {return;} $bytes = filesize( get_attached_file( $post_id ) ); echo size_format( $bytes, 2 ); } add_action( 'admin_print_styles-upload.php', 'filesize_column_filesize' ); function filesize_column_filesize() { echo'<style>#filesize.column-filesize {width: 10%;}</style>';} add_action( 'manage_media_custom_column', 'wh_value', 10, 2 ); function wh_value( $column_name, $post_id ) { if ( 'dimensions' !== $column_name ) {return;} $meta = wp_get_attachment_metadata($post_id); if(isset($meta['width'])){ echo $meta['width'].' x '.$meta['height'];} }
September 22, 2019 at 7:45 pm #1140720Hi Guenni007,
Thanks for sharing :)
Best regards,
VictoriaSeptember 23, 2019 at 9:24 am #1140892Great !
Thanks for help Guenni007,
Best regards,
IcemanSeptember 23, 2019 at 9:36 am #1140901i just look to make the filesize row sortable – But that’s not the first thing on my todo list right now.
September 23, 2019 at 5:25 pm #1141066Thanks again for sharing Guenni007 !
I’m sure you got an idea in order to have search button in line view in Media Library ? Actually, this button only exist in grid view (look in attachement)
https://snipboard.io/OuDVlB.jpgThanks for help Guenni007 !
September 24, 2019 at 9:16 am #1141281September 24, 2019 at 11:00 am #1141335Hi Guenni007,
I don’t know why… I will look for…
September 24, 2019 at 10:08 pm #1141624Hi,
Sure, let us know if anything else.
Best regards,
BasilisSeptember 25, 2019 at 9:51 am #1141710Thank you Basilis !
-
AuthorPosts
- You must be logged in to reply to this topic.