Skip to content

Commit

Permalink
fix: lazyload on image which uses relative urls
Browse files Browse the repository at this point in the history
  • Loading branch information
selul committed Mar 21, 2019
1 parent 2a17f30 commit 4655994
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion inc/tag_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ public function process_image_tags( $content, $images = array() ) {

$src = $tmp = $is_slashed ? stripslashes( $images['img_url'][ $index ] ) : $images['img_url'][ $index ];

$src = $tmp = strpos( $src, $this->upload_resource['content_path'] ) === 0 ? untrailingslashit( $this->upload_resource['content_host'] ) . $src : $src;
if ( strpos( $src, $this->upload_resource['content_path'] ) === 0 ) {
$src = $tmp = untrailingslashit( $this->upload_resource['content_host'] ) . $src;

$new_src = $is_slashed ? addcslashes( $src, '/' ) : $src;
$image_tag = str_replace( $images['img_url'][ $index ], $new_src, $image_tag );
$images['img_url'][ $index ] = $new_src;
}

if ( apply_filters( 'optml_ignore_image_link', false, $src ) ||
false !== strpos( $src, Optml_Config::$service_url ) ||
Expand Down

0 comments on commit 4655994

Please sign in to comment.