Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1140228

    Hello to all,

    Is it possible to display image size and weights in media library screen ?

    Regards,

    Iceman.

    #1140256

    Hey 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 Shannon

    #1140407

    Ok Jordan I understand.
    Thank you for your answer.
    Regards

    #1140428

    if 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

    #1140430

    Thank you Guenni007, it’s nice of you. It’s work perfectly !
    Regads
    Iceman

    #1140431

    or 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'];}
    }

    #1140720

    Hi Guenni007,

    Thanks for sharing :)

    Best regards,
    Victoria

    #1140892

    Great !
    Thanks for help Guenni007,
    Best regards,
    Iceman

    #1140901

    i just look to make the filesize row sortable – But that’s not the first thing on my todo list right now.

    #1141066

    Thanks 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.jpg

    Thanks for help Guenni007 !

    #1141281

    don’t know whats happening on your site – i got a search field on list-view:

    #1141335

    Hi Guenni007,

    I don’t know why… I will look for…

    #1141624

    Hi,

    Sure, let us know if anything else.

    Best regards,
    Basilis

    #1141710

    Thank you Basilis !

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.