Skip to content

Commit

Permalink
Remove HTTP protocol from returned URLs.
Browse files Browse the repository at this point in the history
Fix for HTTPS images. Closes syamilmj#21
  • Loading branch information
bre7 authored Jun 18, 2016
1 parent 1b72aa0 commit dddbfd9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aq_resizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public function process( $url, $width = null, $height = null, $crop = null, $sin
$upload_info = wp_upload_dir();
$upload_dir = $upload_info['basedir'];
$upload_url = $upload_info['baseurl'];
if ( is_ssl() && 'http:' == substr( $upload_url, 0, 5 ) ) {
$upload_url = 'https:' . substr( $upload_url, 5 );
}
if ( is_ssl() && 'http:' == substr( $url, 0, 5 ) ) {
$url = 'https:' . substr( $url, 5 );
}

$http_prefix = "http://";
$https_prefix = "https://";
Expand Down Expand Up @@ -166,11 +172,11 @@ public function process( $url, $width = null, $height = null, $crop = null, $sin
// Return the output.
if ( $single ) {
// str return.
$image = $img_url;
$image = preg_replace('#^https?:#', '', $img_url);
} else {
// array return.
$image = array (
0 => $img_url,
0 => preg_replace('#^https?:#', '', $img_url),
1 => $dst_w,
2 => $dst_h
);
Expand Down

0 comments on commit dddbfd9

Please sign in to comment.