diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php index 00bccf7ac..6268ea360 100644 --- a/wp-admin/upload-functions.php +++ b/wp-admin/upload-functions.php @@ -12,14 +12,18 @@ function wp_upload_display( $dims = false, $href = '' ) { $post_content = apply_filters( 'content_edit_pre', $post->post_content ); $class = 'text'; + $thumb_src = ''; $innerHTML = get_attachment_innerHTML( $id, false, $dims ); if ( $image_src = strstr($innerHTML, 'src="') ) { $image_src = explode('"', $image_src); $image_src = $image_src[1]; + $thumb_src = wp_make_link_relative($image_src); $class = 'image'; - $innerHTML = ' ' . $innerHTML; + $innerHTML = ' ' . str_replace($image_src, $thumb_src, $innerHTML); } + $src = wp_make_link_relative( get_the_guid() ); + $r = ''; if ( $href ) @@ -29,10 +33,10 @@ function wp_upload_display( $dims = false, $href = '' ) { if ( $href ) $r .= "\n"; $r .= "\n\t\t
\n\t\t\t

\n"; - $r .= "\t\t\t\t\n"; + $r .= "\t\t\t\t\n"; if ( $image_src ) - $r .= "\t\t\t\t\n"; + $r .= "\t\t\t\t\n"; if ( isset($width) ) { $r .= "\t\t\t\t\n"; $r .= "\t\t\t\t\n"; diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index d153fb964..11f006789 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1070,4 +1070,11 @@ function js_escape($text) { return preg_replace("/\r?\n/", "\\n", addslashes($text)); } +function wp_make_link_relative( $link, $base = '' ) { + if ( !$base ) + $base = get_option( 'home' ); + if ( 0 === strpos($link, $base) ) + $link = substr_replace($link, '', 0, strlen($base)); + return $link; +} ?>