Make WordPress Core

Ticket #32137: default-press-this-image-size.patch

File default-press-this-image-size.patch, 1.3 KB (added by topdownjimmy, 10 years ago)

Patch to apply image_default_size setting to Press This insertions

  • includes/class-wp-press-this.php

     
    8686                                        // Replace the POSTED content <img> with correct uploaded ones.
    8787                                        // Need to do it in two steps so we don't replace links to the original image if any.
    8888                                        $new_image = str_replace( $image_src, $new_src, $image );
     89                                        // Replace the full image size class name with default image size class name,
     90                                        // if specified.
     91                                        if (get_option('image_default_size') != '' && get_option('image_default_size') !== 'full') {
     92                                                $new_image = str_replace( 'size-full', 'size-' . get_option('image_default_size'), $new_image );
     93                                        }
    8994                                        $content = str_replace( $image, $new_image, $content );
    9095                                }
    9196                        }
  • includes/media.php

     
    856856                        return $id;
    857857                }
    858858
    859                 $src = wp_get_attachment_url( $id );
     859                $src_array = wp_get_attachment_image_src( $id, get_option('image_default_size') );
     860                $src = $src_array[0];
    860861        }
    861862
    862863        // Finally check to make sure the file has been saved, then return the HTML.