Title: Lazy-loaded images not using https (Autooptimizeimages.php)
Last modified: September 27, 2019

---

# Lazy-loaded images not using https (Autooptimizeimages.php)

 *  [tjdyo](https://wordpress.org/support/users/tjdyo/)
 * (@tjdyo)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/lazy-loaded-images-not-using-https-autooptimizeimages-php/)
 * The autoptimizeimages.php file outputs to http instead of https on websites that
   have https enabled everywhere, even when the source image is https.
 * **Line 541:**
    Original Line: `$_url = substr( $url, strpos( $url, '/http' ) 
   + 1 );`
 * Changed it to:
    `$_url = substr( $url, strpos( $url, '/https' ) + 1 );`
 * Would it be possible to get a new feature to enable HTTPS when needed for lazy
   loading?
    -  This topic was modified 6 years, 8 months ago by [tjdyo](https://wordpress.org/support/users/tjdyo/).
    -  This topic was modified 6 years, 8 months ago by [tjdyo](https://wordpress.org/support/users/tjdyo/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/lazy-loaded-images-not-using-https-autooptimizeimages-php/#post-11976255)
 * Hmmm, somewhat surprised; I use lazyload myself on my own site and have no problems
   with images being loaded over http. What are the options you have active on AO’s
   images tab?
 *  Thread Starter [tjdyo](https://wordpress.org/support/users/tjdyo/)
 * (@tjdyo)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/lazy-loaded-images-not-using-https-autooptimizeimages-php/#post-11976444)
 * Well, it’s not that the images weren’t loading with HTTP. It’s the fact that 
   the whole website including the source images are loading via HTTPS.
 * When Autoptimize lazy-loads those images, it swaps/links the files to HTTP. The
   issue with this is it makes browsers still recognize the website as insecure.
   Firefox spits back that the images are the only things not secure. After doing
   some digging, my team and I realized it was Autoptimize’s autooptimizeimages.
   php file.
 * After changing that line of code, the website loads 100% as a secure connection
   and all the images are being loaded via HTTPS.
 * As far as settings go, I just have “Lazy-load images?” checked off in the Images
   section.
    -  This reply was modified 6 years, 8 months ago by [tjdyo](https://wordpress.org/support/users/tjdyo/).
    -  This reply was modified 6 years, 8 months ago by [tjdyo](https://wordpress.org/support/users/tjdyo/).
    -  This reply was modified 6 years, 8 months ago by [tjdyo](https://wordpress.org/support/users/tjdyo/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/lazy-loaded-images-not-using-https-autooptimizeimages-php/#post-11977189)
 * Even more surprised in that case; the code you changed is only executed if “optimize
   images” is also active (it takes care of fetching “lqip” images from Shortpixel)?
   Did some more tests with lazyload and cannot reproduce images being loaded over`
   http://` in that scenario either I’m afraid [@tjdyo](https://wordpress.org/support/users/tjdyo/),
   pretty much at a loss what is going wrong for you there …

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Lazy-loaded images not using https (Autooptimizeimages.php)’ is closed
to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/lazy-loaded-images-not-using-https-autooptimizeimages-php/#post-11977189)
 * Status: not resolved