Index: media.php
===================================================================
--- media.php (revision 32266)
+++ media.php (working copy)
@@ -865,6 +865,10 @@
return $src;
}
+ if ( $return === 'id' ) {
+ return $id;
+ }
+
$alt = isset( $desc ) ? esc_attr( $desc ) : '';
$html = "";
return $html;
Index: class-wp-press-this.php
===================================================================
--- class-wp-press-this.php (revision 32266)
+++ class-wp-press-this.php (working copy)
@@ -80,12 +80,19 @@
}
// Sideload image, which gives us a new image src.
- $new_src = media_sideload_image( $image_src, $post_id, null, 'src' );
+ $image_id = media_sideload_image( $image_src, $post_id, null, 'id' );
+ $src_array = wp_get_attachment_image_src( $image_id, get_option('image_default_size') );
+ $new_src = $src_array[0];
if ( ! is_wp_error( $new_src ) ) {
// Replace the POSTED content with correct uploaded ones.
// Need to do it in two steps so we don't replace links to the original image if any.
$new_image = str_replace( $image_src, $new_src, $image );
+ // Replace the full image size class name with default image size class name,
+ // if specified.
+ if (get_option('image_default_size') != '' && get_option('image_default_size') !== 'full') {
+ $new_image = str_replace( 'size-full', 'size-' . get_option('image_default_size'), $new_image );
+ }
$content = str_replace( $image, $new_image, $content );
}
}