Protecting my images

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
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Protecting my images

Post by TonsOfFun »

So here is my issue.

I have a website for a photographer.
I want to protect the photos from theft. I watermarked the photos so I can display them, but I want to keep the original clean.

I tried to create a directory outside the root, but the host doesn't allow that.

Any suggestions or tutorials would be great.
Gargoyle
Forum Contributor
Posts: 130
Joined: Wed Jul 14, 2010 12:25 am

Re: Protecting my images

Post by Gargoyle »

you can't.

there are some ways to protect the images by disabling mouse right click, but this can easily be circumvented by disabling javascript.

even with the most sophisticated obfuscation, you can't stop the user from just taking a screenshot. so if your images are that valuable, don't put them on a public website.
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Re: Protecting my images

Post by TonsOfFun »

Gargoyle wrote:you can't.

there are some ways to protect the images by disabling mouse right click, but this can easily be circumvented by disabling javascript.

even with the most sophisticated obfuscation, you can't stop the user from just taking a screenshot. so if your images are that valuable, don't put them on a public website.

I'm not worried about the screenshot, is there a way to prevent them from accessing the file directly, or hiding the location of the file in the source code?
Gargoyle
Forum Contributor
Posts: 130
Joined: Wed Jul 14, 2010 12:25 am

Re: Protecting my images

Post by Gargoyle »

you can check the referrer to avoid hotlinking, but you can't hide an image source unless you put it into a java applet or flash movie.

you could also defined your images as background images and use an external css file to define the image urls in. you could then serve the css file through a php script which will also check the referrer. this requires some fiddling though.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Protecting my images

Post by Jonah Bron »

Simple. Put all of the clean images in one folder, and dis-allow access with .htaccess.

[syntax]<Directory cleanfolder>
order allow,deny
deny from all
<Directory>[/syntax]
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Re: Protecting my images

Post by TonsOfFun »

Jonah Bron wrote:Simple. Put all of the clean images in one folder, and dis-allow access with .htaccess.

[syntax]<Directory cleanfolder>
order allow,deny
deny from all
<Directory>[/syntax]

I was hoping to avoid this but it seems like the only way.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Protecting my images

Post by Jonah Bron »

Why were you trying to avoid it? It's very simple.
  • root/
    • .htaccess (provided above)
    • cleanfolder/
      • clean images...
jazzercising011
Forum Newbie
Posts: 9
Joined: Tue Sep 14, 2010 4:47 am

Re: Protecting my images

Post by jazzercising011 »

hold up. Why do you have to create a folder outside the root. You can have a folder with the clean images password protected so they can't access it inside the root. Then have your script create the watermarked versions in a new folder. If you want to be extra secure about it create a large watermark so that when they do a screen capture the image is useless. use a .htpasswd file to password protect the directory of clean images.
PradeepKr
Forum Newbie
Posts: 14
Joined: Wed Aug 11, 2010 8:29 am

Re: Protecting my images

Post by PradeepKr »

password protect the directory.
Post Reply