WordPress.org

Make WordPress Core


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

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

File:
1 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 {
Note: See TracChangeset for help on using the changeset viewer.