Originally posted by BlackenedSky
One other option based on the storing the images in a database idea is to save teh images into a database and then load them and display tehm from teh database [..]
This does not help. It does not where the images are. If they are stored in a database or in directory on the filesystem.
Personally, I suggest to store only metadata in the database.
Originally posted by BlackenedSky
Addtionally you could create the files with random names via PHP based on what you pull from teh database and then delete them when they are no longer needed. This way the image only exists while the server is loading it.
What is the benefit. You will have certain link within a HTML document to the image to display. [font=courier]wget[/font] or other tools will get the link and such will get the image indepent where the image is fetched from (database, filesystem, ...).
To give you an working example: Take a look at the image: http://www.pingu.info/test/lasvegas.jpg
What you will see is an image, which you will not expect by the name of the image.
Now go to the main page http://www.pingu.info and log in with the username "phpbuilder" and the password "test" and then go back to the see the image http://www.pingu.info/test/lasvegas.jpg
Now, you will see what you expect by the name of this image.
(Currently, this will only work wiith cookies enabled, because the cookie will have the session ID.)
I can say, the image is placed at exactly that directory on the filesystem. No database, except for the user login. Even the access control itself is made without a database. It is just an XML files placed in the very same directory with the information to whom access is allowed:
<access type="restricted" user="phpbuilder" />
No complicated file create, delete, rename or whatever. Because this will only create server load without any benefit.
The relevant part of the script is only this
// output the file
if ($xmlAccess->isPublic($PATHS["filename"]) ||
($xmlAccess->isRestricted($PATHS["filename"]) && $xmlAccess->verify($PATHS["filename"], $Access)))
readfile($PATHS["file"]);
else {
switch ($PATHS["filetype"]) {
case "jpg":
case "jpeg": readfile($PATHS["base"] . "images/noaccess.jpg"); break;
case "png" : readfile($PATHS["base"] . "images/noaccess.png"); break;
case "gif" : readfile($PATHS["base"] . "images/noaccess.gif"); break;
} // switch ($PATHS["filetype"])
} // if ($xmlAccess->isPublic($PATHS["filename"]) || ... else
// now everything should be ok, we can leave the script
exit;
But even this can be theft with an automated script. Even as it is based on session and the user name and password has to be a POST request (GET request will not work).
Watermarking will not help against theft. It will help only to show the legitimate copyright holder.
Currently, the most highiest barrier is the thing with Java or Flash as already suggested, AFAIK.
Again, a foolproof solution will never exist. The question is only how high do I set barrier to get it. This will depend on the value of the images.
Pingu