Limited-Time Donation Special!
Upgrade to Snow for $20 USD and receive a free copy of Oblivion Light ($5 discount).
Upgrade to +Blizzard for $35 USD and receive a free copy of Oblivion Light ($15 discount).

Please visit the thread below for more details.
CLICK HERE

Contact @Davlin with questions or comments.

Jump to content
Sign in to follow this  
SloCket

How to load non-https images on a https site

Recommended Posts

Today I will introduce you a simple and quick way to display all over our site as long as it took for the page that I entered to upload.

In order to load any non-https image on a https site without having any problems with our site being secure but containing non-ssl elements I will introduce a php code that helped me a lot.

The code is simple. Before the URL that we want to do https add the script address.

The code is the following:


<?php
 
error_reporting(0);
 
if(isset($_GET['adresa'])) {
if(filter_var(strip_tags($_GET['adresa']), FILTER_VALIDATE_URL)) {
 
$date_adresa = getimagesize($_GET['adresa']);
header("Content-type: {$date_adresa['mime']}");
readfile($_GET['adresa']);
 
}
}
?>

 

Share this post


Link to post
Share on other sites

So, if I understand this correctly, the code is downloading the image to the server so the server can display the image, hence it's now a https link?  Or am I missing something?  Comments would have helped a php noob like me understand what is going on in the code. :)

Share this post


Link to post
Share on other sites
What do you think? Remember the human.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×