Make WordPress Core

Changeset 22749


Ignore:
Timestamp:
11/21/2012 12:05:24 PM (12 years ago)
Author:
nacin
Message:

Properly refresh the thumbnail on post.php after an image edit. props ocean90. see #21391.

Location:
trunk/wp-admin/includes
Files:
2 edited

Legend:

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

    r22510 r22749  
    711711
    712712        if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
    713             $file_url = wp_get_attachment_url($post_id);
    714             if ( $thumb = $meta['sizes']['thumbnail'] )
    715                 $return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
    716             else
    717                 $return->thumbnail = "$file_url?w=128&h=128";
     713            // Check if it's an image edit from attachment edit screen
     714            if ( false !== strpos( wp_get_referer(), 'post.php' ) ) {
     715                $thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
     716                $return->thumbnail = $thumb_url[0];
     717            } else {
     718                $file_url = wp_get_attachment_url($post_id);
     719                if ( $thumb = $meta['sizes']['thumbnail'] )
     720                    $return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
     721                else
     722                    $return->thumbnail = "$file_url?w=128&h=128";
     723            }
    718724        }
    719725    } else {
  • trunk/wp-admin/includes/media.php

    r22748 r22749  
    22702270
    22712271        <div class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
    2272             <p><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" width="<?php echo $thumb_url[1]; ?>" alt="" /></p>
     2272            <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>
    22732273            <p><?php echo $image_edit_button; ?></p>
    22742274        </div>
Note: See TracChangeset for help on using the changeset viewer.