Jump to content

Hide Remote Image Url


gdfhghjdfghgfhf

Recommended Posts

I'm looking for a way to hide the URL of the remote images included in one of my page.

 

I've done that :

 

$image = base64_encode("https://www.google.ca/images/srpr/logo3w.png");

echo "<img src=\"image.php?img=$image\">";

 

$path = base64_decode(addslashes($_GET['img']));

$image = imagecreatefromstring(file_get_contents($path));

header('Content-type: image/png');

imagepng($image);

exit();

 

But it makes the loading of the page really slower because the image needs to be loaded on my server before being displayed to the users... So i'm looking for a faster way to do it...

 

Any idea ? Maybe with htaccess ?

Link to comment
Share on other sites

You cannot hide the URL of an image from the user. It is impossible. What you can do is give the URL to an "image" on your server which then outputs the appropriate image. Note I said output, not redirect. That's the same thing you're doing now.

 

And you should know that base-64 encoding is really, really easy to identify. What you're doing is trivial to unravel.

Edited by requinix
Link to comment
Share on other sites

Why would you want to hide the picture's URLs from the user? They can just right click on them, select "properties" and see where they come from anyway. If it's to prevent people from downloading them, then you should know that the browser has already downloaded all of the files it shows; Otherwise it cannot show them to the user.

Link to comment
Share on other sites

What you can do is give the URL to an "image" on your server which then outputs the appropriate image. Note I said output, not redirect. That's the same thing you're doing now.

That's what i meant by "hiding" the real URL. But the way i am doing it, the server must load the content of the image before displaying it to the user and it makes the page loading time longer... Is there a better way ?

 

Why would you want to hide the picture's URLs from the user? They can just right click on them, select "properties" and see where they come from anyway. If it's to prevent people from downloading them, then you should know that the browser has already downloaded all of the files it shows; Otherwise it cannot show them to the user.

I don't care if the users download the image. I just don't want them to know where it's coming from. I want them to think the image is hosted on my server, not on a remote website.

Edited by ungovernable
Link to comment
Share on other sites

You got permission from the remote website to do this then?

 

Also, if you want to cut down on the latency time, the only thing you can do is to actually host the images on your own server. Otherwise the users have to wait for your server to download them, before it can send the data onwards to their browsers.

Link to comment
Share on other sites

That's what i meant by "hiding" the real URL. But the way i am doing it, the server must load the content of the image before displaying it to the user and it makes the page loading time longer... Is there a better way ?

Nope. The image has to come from, or through, your server.

 

You know Google has an image search, right? I can give the URL of an image and it'll find the places where it's used. So even hiding the URL perfectly like you're doing now can be defeated.

Link to comment
Share on other sites

You got permission from the remote website to do this then?

Yes. This is my website.

 

Here's my situation:

I have a spreadshirt t-shirt shop hosted on Spreadshirt.com. I'm building a php website to display my shop on my own website using their API, so the users will think it's my own shop. But the images are still hosted on Spreadshirt.com

If the users know the shop comes from Spreadshirt, they can just copy my images and make their own t-shirts from my supplier.

 

I think i may just consider taking the binaries from the images and storing it in my database as Blob

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.