| 1 | Index: wp-includes/bookmark-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/bookmark-template.php (revision 19633) |
|---|
| 4 | +++ wp-includes/bookmark-template.php (working copy) |
|---|
| 5 | @@ -100,11 +100,32 @@ |
|---|
| 6 | |
|---|
| 7 | $output .= $link_before; |
|---|
| 8 | |
|---|
| 9 | - if ( $bookmark->link_image != null && $show_images ) { |
|---|
| 10 | - if ( strpos($bookmark->link_image, 'http') === 0 ) |
|---|
| 11 | - $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; |
|---|
| 12 | - else // If it's a relative path |
|---|
| 13 | - $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />"; |
|---|
| 14 | + if ( $bookmark->link_image != null && $show_images ) { |
|---|
| 15 | + if ( strpos($bookmark->link_image, 'http') === 0 ) { |
|---|
| 16 | + $size = @getimagesize( $bookmark->link_image ); |
|---|
| 17 | + |
|---|
| 18 | + if( !$size ) |
|---|
| 19 | + return new WP_Error( 'invalid_image', __('Could not read image size'), $bookmark->link_image ); |
|---|
| 20 | + |
|---|
| 21 | + list( $width, $height, $image_type, $size_string ) = $size; |
|---|
| 22 | + |
|---|
| 23 | + if ( '' != $size_string ) |
|---|
| 24 | + $size_attrib = $size_string; |
|---|
| 25 | + |
|---|
| 26 | + $output .= "<img src=\"$bookmark->link_image\" $size_attrib $alt $title />"; |
|---|
| 27 | + } else { // If it's a relative path |
|---|
| 28 | + $size = @getimagesize( get_option('siteurl') . $bookmark->link_image ); |
|---|
| 29 | + |
|---|
| 30 | + if( !$size ) |
|---|
| 31 | + return new WP_Error( 'invalid_image', __('Could not read image size'), get_option('siteurl') . $bookmark->link_image ); |
|---|
| 32 | + |
|---|
| 33 | + list( $width, $height, $image_type, $size_string ) = $size; |
|---|
| 34 | + |
|---|
| 35 | + if ( '' != $size_string ) |
|---|
| 36 | + $size_attrib = $size_string; |
|---|
| 37 | + |
|---|
| 38 | + $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $size_attrib $alt $title />"; |
|---|
| 39 | + } |
|---|
| 40 | |
|---|
| 41 | if ( $show_name ) |
|---|
| 42 | $output .= " $name"; |
|---|