WordPress and buddypress programming

show image dimensions in media library

Viewing 0 reply threads
  • Author
    Posts
    • #1504
      michael mc
      Keymaster
      @michael

      #wordpress #code

      // Show image dimensions in media library overview
      function wh_column( $cols ) {
              $cols["dimensions"] = "Dimensions (w, h)";
              return $cols;
      }
      add_filter( 'manage_media_columns', 'wh_column' );
      function wh_value( $column_name, $id ) {
          if ( $column_name == "dimensions" ):
          $meta = wp_get_attachment_metadata($id);
                 if(isset($meta['width']))
                 echo $meta['width'].' x '.$meta['height'];
          endif;
      }
      add_action( 'manage_media_custom_column', 'wh_value', 11, 3 );
Viewing 0 reply threads
  • You must be logged in to reply to this topic.