Make WordPress Core


Ignore:
Timestamp:
12/06/2012 05:52:19 AM (14 years ago)
Author:
markjaquith
Message:

Add the ability to click "Edit" and kick out to the advanced image editor from within the Media modal. New window, with "Refresh" offered on your return. fixes #22743. props koopersmith, nacin, helenyhou.

File:
1 edited

Legend:

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

    r23086 r23095  
    22712271        $post = get_post();
    22722272
     2273        $open = isset( $_GET['image-editor'] );
     2274        if ( $open )
     2275                require_once ABSPATH . 'wp-admin/includes/image-edit.php';
     2276
    22732277        $thumb_url = false;
    22742278        if ( $attachment_id = intval( $post->ID ) )
    2275                 $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 600 ), true );
     2279                $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
    22762280
    22772281        $filename = esc_html( basename( $post->guid ) );
    22782282        $title = esc_attr( $post->post_title );
    22792283        $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
    2280 
    2281         $media_dims = '';
    2282         $meta = wp_get_attachment_metadata( $post->ID );
    2283         if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
    2284                 $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    2285         $media_dims = apply_filters( 'media_meta', $media_dims, $post );
    22862284
    22872285        $att_url = wp_get_attachment_url( $post->ID );
    … …  
    22972295                <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
    22982296
    2299                 <div class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
     2297                <div<?php if ( $open ) echo ' style="display:none"'; ?> class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
    23002298                        <p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
    23012299                        <p><?php echo $image_edit_button; ?></p>
    23022300                </div>
    2303                 <div style="display:none" class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"></div>
     2301                <div<?php if ( ! $open ) echo ' style="display:none"'; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
     2302                        <?php if ( $open ) wp_image_editor( $attachment_id ); ?>
     2303                </div>
    23042304        </div>
    23052305        <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.