Jump to content

how to hide image path


argrafic

Recommended Posts

If you create a PHP script that will load in the image, as DarkWater suggested, and output it in PHP the user will not see the path of the file, the will just see  something like 'something/output_image.php'. But if you are trying to prevent people from stealing the image that will not help..

 

If your just trying to hide the path and dont care if people steal your images then DarkWater's suggestion is the way to go

If your displaying an image, there is no way you can stop the user from downloading it. (When loaded it's already in a temp folder on the user's computer, in most browsers). But if they just want to hide the directory of images, you could serve the images through a PHP script, as already suggested.

you could do as stated above, and if you're worried about people downloading the images you could create a div the size of the image containing a transparent gif/png stretched to the size of the image, that way if you right click and save the image you actually save the transparent gif/png instead  :) (flickr does this)

 

something like

 

<?php

$src_img = "path_to_image.extention"

$origw = imagesx($src_img);
$origh = imagesy($src_img);


echo "<div id=\"imagediv\" name=\"imagediv\" style=\"width: ".$origw."px;height: ".$origh."px;background-image: url($src_image);\"><img src=\"spaceball.gif\" width=\"".$origw."px\" height=\"".$origh."px\" alt=\"Image Title\"></div><br>\n";

?>

 

or i could teach you how to do this:

 

showimage.php?image=YWxidW1zL2FyYm9yYXR1bS9EU0MwMDE1My5KUEc=

 

hope this was helpful,

 

aseaofflames

 

PS: like was said before, images are cached, so there is no way to totally prevent people from stealing them, but you can make it harder  :)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.