Make WordPress Core


Ignore:
Timestamp:
09/10/2009 10:07:33 PM (16 years ago)
Author:
azaozz
Message:

Image editing (first run). Includes code by stephanreiter, see #10528

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r11904 r11911  
    11521152    }
    11531153
     1154    $media_dims = '';
     1155    $meta = wp_get_attachment_metadata($post->ID);
     1156    if ( is_array($meta) && array_key_exists('width', $meta) && array_key_exists('height', $meta) )
     1157        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     1158
     1159    $image_edit_button = '';
     1160    if ( gd_edit_image_support($post->post_mime_type) ) {
     1161        $nonce = wp_create_nonce("image_editor-$post->ID");
     1162        $image_edit_button = "<tr><td class='A1B1'><input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open($post->ID, \"$nonce\")' class='button' value='" . esc_attr__( 'Edit image' ) . "' /> <img src='images/wpspin_light.gif' class='imgedit-wait-spin' alt='' /></td></tr>";
     1163    }
     1164
    11541165    $item = "
    11551166    $type
     
    11581169    $display_title
    11591170    <table class='slidetoggle describe $class'>
    1160         <thead class='media-item-info'>
     1171        <thead class='media-item-info' id='media-head-$post->ID'>
    11611172        <tr>
    1162             <td class='A1B1' rowspan='4'><img class='thumbnail' src='$thumb_url' alt='' /></td>
     1173            <td class='A1B1' rowspan='5'><img class='thumbnail' src='$thumb_url' alt='' /></td>
    11631174            <td>$filename</td>
    11641175        </tr>
    11651176        <tr><td>$post->post_mime_type</td></tr>
    11661177        <tr><td>" . mysql2date($post->post_date, get_option('time_format')) . "</td></tr>
    1167         <tr><td>" . apply_filters('media_meta', '', $post) . "</td></tr>
     1178        <tr><td>" . apply_filters('media_meta', $media_dims, $post) . "</td></tr>
     1179        $image_edit_button
    11681180        </thead>
    1169         <tbody>\n";
     1181        <tbody>
     1182        <tr><td style='display:none' colspan='2' id='image-editor-$post->ID'></td></tr>\n";
    11701183
    11711184    $defaults = array(
     
    21312144add_filter('media_upload_library', 'media_upload_library');
    21322145
    2133 ?>
Note: See TracChangeset for help on using the changeset viewer.