Skip to content

Commit 946c23f

Browse files
committed
Merge branch 'rowatt-fix-jetpack-post-images-notice'
2 parents f2de87e + 68531fc commit 946c23f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: class.jetpack-post-images.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,19 @@ static function from_attachment( $post_id, $width = 200, $height = 200 ) {
194194
* We can load up all the images found in the HTML source and then
195195
* compare URLs to see if an image is attached AND inserted.
196196
*/
197-
$html_images = array();
198197
$html_images = self::from_html( $post_id );
199198
$inserted_images = array();
200199

201200
foreach( $html_images as $html_image ) {
202201
$src = parse_url( $html_image['src'] );
203-
$inserted_images[] = $src['scheme'] . '://' . $src['host'] . $src['path']; // strip off any query strings
202+
// strip off any query strings from src
203+
if( ! empty( $src['scheme'] ) && ! empty( $src['host'] ) ) {
204+
$inserted_images[] = $src['scheme'] . '://' . $src['host'] . $src['path'];
205+
} elseif( ! empty( $src['host'] ) ) {
206+
$inserted_images[] = set_url_scheme( 'http://' . $src['host'] . $src['path'] );
207+
} else {
208+
$inserted_images[] = site_url( '/' ) . $src['path'];
209+
}
204210
}
205211
foreach( $images as $i => $image ) {
206212
if ( !in_array( $image['src'], $inserted_images ) )

0 commit comments

Comments
 (0)