In my code, I force the images to load http. However some users hosting their images also get images with https because they are hosted on secure servers and suddenly, they are not displayed on my site. How to display them, without changing my source code of the application
By default, when I display an image :
<img src="http://-HERE url of the image without http or https-">
You need to use the protocol provided by the user.
They can host different content on http and https. You can't know it.
The protocol is part of the uri, like the domain or the path. You can't decide it for others.
The only problem is if your website use https: you can't include http images without mixed-content issues.
You can use the Javascript function 'onerror' and change http to https, to try and solve the problem of it occurs, so it would look like this%
<img src="url" onError="yourerrorfunction()" >
Don't forget to break if it's already https to make sure it doesn't end up becoming an infinite loop
I think you might be able to ignore the protocol from the url, like:
<img src='//example.com/images/img001.jpg' alt='' title='' />
I have seen this done with scripts so it might be worth a go!