Make WordPress Core

Ticket #20534: 20534.2.diff

File 20534.2.diff, 896 bytes (added by justindgivens, 13 years ago)

Better fix instead of just for the post thumbnail. This fixes the Media and Media Edit pages as well.

  • wp-includes/media.php

     
    605605function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) {
    606606
    607607        // get a thumbnail or intermediate image if there is one
    608         if ( $image = image_downsize($attachment_id, $size) )
     608        if ( $image = image_downsize($attachment_id, $size) ) {
     609                if ( force_ssl_admin() && is_admin() ) {
     610                        $image = str_replace('http://', 'https://', $image);
     611                }
    609612                return $image;
     613        }
    610614
    611615        $src = false;
    612616
     
    616620                @list($width, $height) = getimagesize($src_file);
    617621        }
    618622        if ( $src && $width && $height )
     623                if ( force_ssl_admin() && is_admin() ) {
     624                        $src = str_replace('http://', 'https://', $src);
     625                }
    619626                return array( $src, $width, $height );
    620627        return false;
    621628}