Image security

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
_ThndR
Forum Newbie
Posts: 20
Joined: Fri May 26, 2006 12:02 pm
Location: Leeuwarden, The Netherlands

Image security

Post by _ThndR »

I've got this little question. I doubt there is a way to do it, but I wanted to ask you to be certain.

Is there a way to secure an image in such a way, that the image can only be shown when it is called by a (php) script?

If you are wondering why I would want such thing: well, I have some images that only members should be able to see. I don't want everyone to be able to see the images via anything like http://www.site.com/image.jpg.

I know this has got more to do with CHMOD than with php probably :P

I hope I'm clear in my explanation; any help would be appreciated.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Yes, just store the image in a location on the server that is not assessible from the internet then include it when you want it.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

This can be achieved two ways: storing it outside of your webdirectory, or using htaccess to forbid all
Post Reply