Make WordPress Core

Ticket #21391: 21391.8.patch

File 21391.8.patch, 2.1 KB (added by ocean90, 12 years ago)
  • wp-admin/includes/media.php

     
    22442244        $title = esc_attr( $post->post_title );
    22452245        $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
    22462246
    2247         $post_mime_types = get_post_mime_types();
    2248         $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
    2249         $type = array_shift( $keys );
    2250         $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    2251 
    22522247        $media_dims = '';
    22532248        $meta = wp_get_attachment_metadata( $post->ID );
    22542249        if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
     
    22942289        foreach ( $extras['hidden'] as $hidden_field => $value ) {
    22952290                echo '<input type="hidden" name="' . esc_attr( $hidden_field ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
    22962291        }
     2292        echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
    22972293}
    22982294
    22992295/**
  • wp-admin/includes/image-edit.php

     
    711711
    712712                if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
    713713                        // Check if it's an image edit from attachment edit screen
    714                         if ( false !== strpos( wp_get_referer(), 'post.php' ) ) {
     714                        if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
    715715                                $thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
    716716                                $return->thumbnail = $thumb_url[0];
    717717                        } else {
  • wp-admin/js/image-edit.js

     
    245245                        'postid': postid,
    246246                        'history': history,
    247247                        'target': target,
     248                        'context': $('#image-edit-context') ? $('#image-edit-context').val() : null,
    248249                        'do': 'save'
    249250                };
    250251