argrafic Posted June 5, 2008 Share Posted June 5, 2008 hello all. i'm developing a gallery but we want to hide the path where the image is stored. is that possible and how? thanks!! Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/ Share on other sites More sharing options...
DarkWater Posted June 5, 2008 Share Posted June 5, 2008 Not really. Unless you make a PHP script that serves the images. Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-558721 Share on other sites More sharing options...
haku Posted June 6, 2008 Share Posted June 6, 2008 It is possible using a script as darkwater said. But someone will still be able to access the image through that script unless you work with a database to limit the number of times it can be downloaded or what not. What are you trying to accomplish? Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-558891 Share on other sites More sharing options...
Buddski Posted June 6, 2008 Share Posted June 6, 2008 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 Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-558905 Share on other sites More sharing options...
argrafic Posted June 6, 2008 Author Share Posted June 6, 2008 well, the people i'm developing for don't want the users to know where all the images are stored, they are afraid someone could steal the images. Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-559336 Share on other sites More sharing options...
discomatt Posted June 6, 2008 Share Posted June 6, 2008 If they view the images, they already have them cached somewhere on their computer. I guess this is 'stolen' Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-559343 Share on other sites More sharing options...
thebadbad Posted June 6, 2008 Share Posted June 6, 2008 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. Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-559344 Share on other sites More sharing options...
aseaofflames Posted June 6, 2008 Share Posted June 6, 2008 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: 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 Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-559346 Share on other sites More sharing options...
haku Posted June 8, 2008 Share Posted June 8, 2008 The best thing you can do to protect your images is to put a watermark on them. Link to comment https://forums.phpfreaks.com/topic/108910-how-to-hide-image-path/#findComment-560154 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.