aeonsky Posted February 14, 2008 Share Posted February 14, 2008 Hello! I've look around Google for an answer, but I couldn't get anything conclusive... Is the only way to hide the image url/path from user, like this below: <img src="index.php/images/disp.php?image=004 Is to use the PHP image functions to recompress it and the display using something like this: ImageJpeg (); Thanks for the time and consideration! You guys are great! Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/ Share on other sites More sharing options...
Northern Flame Posted February 14, 2008 Share Posted February 14, 2008 what i sometimes do is create a page, lets say image.php, and have the code go like this: <?php include('image.jpg'); ?> so when the user accesses the page, it just displays a bunch of code, but it still works when you do this: <img src="image.php"> Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-466531 Share on other sites More sharing options...
aeonsky Posted February 14, 2008 Author Share Posted February 14, 2008 what i sometimes do is create a page, lets say image.php, and have the code go like this: <?php include('image.jpg'); ?> so when the user accesses the page, it just displays a bunch of code, but it still works when you do this: <img src="image.php"> Wait, how does that supposed to work? I just tried it, I get a bunch of ASCII errors. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-466535 Share on other sites More sharing options...
Northern Flame Posted February 14, 2008 Share Posted February 14, 2008 really? it works for me Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-466542 Share on other sites More sharing options...
Northern Flame Posted February 14, 2008 Share Posted February 14, 2008 take a look at this: http://www.lab.northernflame.com/image/ http://www.lab.northernflame.com/image/image.php http://www.lab.northernflame.com/image/image.jpg look at the source for http://www.lab.northernflame.com/image/ Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-466545 Share on other sites More sharing options...
aeonsky Posted February 22, 2008 Author Share Posted February 22, 2008 This script does work, but it seems only for JPG images. I need the script to support multiple image formats, and PNG do not work. Any other ways to hide the image source? Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-473281 Share on other sites More sharing options...
mainewoods Posted February 22, 2008 Share Posted February 22, 2008 <img src="index.php/images/disp.php?image=004"> the 'disp.php' file can fopen a file then fread it and then echo it out. The file to fopen can even be in a directory that does not allow direct web access to the files. You'll want to use the php header function to set the content type header before echoing out the file contents: header("Content-type: image/gif"); echo file_get_contents("/directory/file4.gif"); this method should work for every image type, I have used it for jpg's and gif's. Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-473350 Share on other sites More sharing options...
aeonsky Posted February 22, 2008 Author Share Posted February 22, 2008 Thanks everyone, I fixed it! I modified Northern Flame's script by using readfile and forwarding the contents to itself, because I can not load the contents into a single file since a lot of people will be using at once (don't want any problems). Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-473361 Share on other sites More sharing options...
uniflare Posted February 22, 2008 Share Posted February 22, 2008 i would advise to use this function sparingly as it will take up a lot of resources, especially with larger images. if the client wanted the image you cannot stop him.her from prntscrn'ing, in my view trying to hide the source file is a little pointless. hope this helps, Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-473367 Share on other sites More sharing options...
zenlanka Posted January 7, 2010 Share Posted January 7, 2010 Try http://pvtlink.com , you can hide image location or downloadable file path . Also you can use this service even if you don;t have programming skills Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-990127 Share on other sites More sharing options...
laffin Posted January 7, 2010 Share Posted January 7, 2010 In Response to uniflare: This is true, that the current script has no benefit. However, I dont see it using that much more resources than using your web servers mime handler, you are just transferring the mime handling to a php script. but it can be the base for a more functional script, hit counter, hot-link prevention and so forth. Quote Link to comment https://forums.phpfreaks.com/topic/91019-hide-image-urlpath-from-user/#findComment-990136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.