Make WordPress Core

Ticket #21391: 21391.thumbnail-refresh.patch

File 21391.thumbnail-refresh.patch, 2.0 KB (added by ocean90, 13 years ago)

Refresh the thumbnail

  • wp-admin/includes/media.php

     
    21412141                <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
    21422142
    21432143                <div class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
    2144                         <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>
     2144                        <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>
    21452145                        <p><?php echo $image_edit_button; ?></p>
    21462146                </div>
    21472147                <div style="display:none" class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"></div>
  • wp-admin/includes/image-edit.php

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