Image don't load using HTTPS

I have problem to see image post when use HTTPS. The principal image is showing using HTTPS but another it not.

<img width="683" height="410" src="//modamasculina-dicas.com.br/content/uploads/2015/12/estilos.jpg" class="single-featured wp-post-image" alt="estilos" srcset="http://modamasculina-dicas.com.br/content/uploads/2015/12/estilos-300x180.jpg 300w, http://modamasculina-dicas.com.br/content/uploads/2015/12/estilos-768x461.jpg 768w, http://modamasculina-dicas.com.br/content/uploads/2015/12/estilos-1024x614.jpg 1024w, http://modamasculina-dicas.com.br/content/uploads/2015/12/estilos.jpg 1600w" sizes="(max-width: 683px) 100vw, 683px">

The main image use //moda… that allow to browser detect is using HTTPS or not, but the srcset not use this forcing browser to call http. But the image is blocked because of mixed protocol.

Hi @hotforms,

I hope you are well today and thanks for posting here.

It seems the issue with the latest version of WordPress.

To resolve the issue could you please try using the solution posted on the following page?

http://wptavern.com/how-to-fix-images-not-loading-in-wordpress-4-4-while-using-ssl

Best Regards,
Movin

Thanks @Movin, this fix my problem. But in my case I’m using CloudFlare SSL so I put the code below in my functions.php and the problem was fixed \o/


//wordpress 4.4 srcset ssl fix
function cloudflare_ssl_srcset( $sources ) {

	$cloudflare_protocol_rewrite = load_protocol_rewrite();

	if ($cloudflare_protocol_rewrite == 1) {

	foreach ( $sources as &$source ) {
		$source['url'] = set_url_scheme( $source['url'] );
	}

	return $sources;

	} else {

		foreach ( $sources as &$source ) {
			$sources;
		}

		return $sources;

	}
}
add_filter( 'wp_calculate_image_srcset', 'cloudflare_ssl_srcset' );

Hi @hotforms,

Awesome great to see you got that fixed and thanks for sharing the solution here.

Please advise if you have more questions.

Have a fantastic day!

Cheers,
Movin