Image Editor: fix refreshing of the thumbnail, use WP_Http_Fopen::test(), see #10528

git-svn-id: http://svn.automattic.com/wordpress/trunk@11985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-09-30 23:39:09 +00:00
parent 6f099a9117
commit 4e20ae5719
1 changed files with 5 additions and 4 deletions

View File

@ -218,7 +218,7 @@ function load_image_to_edit($post_id, $mime_type, $size = 'full') {
if ( $filepath && file_exists($filepath) ) {
if ( 'full' != $size && ( $data = image_get_intermediate_size($post_id, $size) ) )
$filepath = path_join( dirname($filepath), $data['file'] );
} elseif ( function_exists('fopen') ) {
} elseif ( WP_Http_Fopen::test() ) {
$filepath = wp_get_attachment_url($post_id);
}
@ -627,10 +627,11 @@ function wp_save_image($post_id) {
update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
if ( $thumb = $meta['sizes']['thumbnail'] ) {
$file_url = wp_get_attachment_url($post_id);
$file_url = wp_get_attachment_url($post_id);
if ( $thumb = $meta['sizes']['thumbnail'] )
$return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
}
else
$return->thumbnail = "$file_url?w=128&h=128";
}
} else {
$delete = true;