Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i'm trying to add image size in media library screen so will be simply to handle images. Anyone does it before me? Any help appreciated. Francesco

share|improve this question
    
Codex: add_image_size(); –  kaiser Oct 12 '11 at 19:59
    
Investigating this Q&A, I ended up assembling a two sortable columns solution (width & height). I posted it in this other question because there the sortable functionality is being asked... But @Rarst answer and link got me started in the first place. –  brasofilo Jun 5 '12 at 14:41
add comment

1 Answer

Code based on Custom Sortable Columns

add_filter('manage_upload_columns', 'size_column_register');

function size_column_register($columns) {

    $columns['dimensions'] = 'Dimensions';

    return $columns;
}

add_action('manage_media_custom_column', 'size_column_display', 10, 2);

function size_column_display($column_name, $post_id) {

    if( 'dimensions' != $column_name || !wp_attachment_is_image($post_id))
        return;

    list($url, $width, $height) = wp_get_attachment_image_src($post_id, 'full');

    echo esc_html("{$width}×{$height}");
}
share|improve this answer
    
thank you very much. work like a charm. –  Francesco Di Candia Oct 13 '11 at 9:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.