Ticket #32137: 32137.2.patch
File 32137.2.patch, 1.5 KB (added by , 10 years ago) |
---|
-
media.php
865 865 return $src; 866 866 } 867 867 868 if ( $return === 'id' ) { 869 return $id; 870 } 871 868 872 $alt = isset( $desc ) ? esc_attr( $desc ) : ''; 869 873 $html = "<img src='$src' alt='$alt' />"; 870 874 return $html; -
class-wp-press-this.php
80 80 } 81 81 82 82 // Sideload image, which gives us a new image src. 83 $new_src = media_sideload_image( $image_src, $post_id, null, 'src' ); 83 $image_id = media_sideload_image( $image_src, $post_id, null, 'id' ); 84 $src_array = wp_get_attachment_image_src( $image_id, get_option('image_default_size') ); 85 $new_src = $src_array[0]; 84 86 85 87 if ( ! is_wp_error( $new_src ) ) { 86 88 // Replace the POSTED content <img> with correct uploaded ones. 87 89 // Need to do it in two steps so we don't replace links to the original image if any. 88 90 $new_image = str_replace( $image_src, $new_src, $image ); 91 // Replace the full image size class name with default image size class name, 92 // if specified. 93 if (get_option('image_default_size') != '' && get_option('image_default_size') !== 'full') { 94 $new_image = str_replace( 'size-full', 'size-' . get_option('image_default_size'), $new_image ); 95 } 89 96 $content = str_replace( $image, $new_image, $content ); 90 97 } 91 98 }