I made this a while back for my own gallery. So far it prevents copying as far as I know without using brute force and digging through cache or screenshoting the browser. I thought I might share and perhaps someone may help improve it as well.
Although it does exactly what I intended it to do, I cannot call it an actual plugin or add-on. The install is a bit lousy I admit. :P Sadly it modifies to coppermine files. To use it, you must include either the code or the file containing the code, into your theme file. I haven't really had a chance to look into how to make it a plugin, but more or less I'd like to not have to be able to modify the following files, but just overwrite the script/functions:
profile.php - for the thumbnails
/include/slideshow.inc.php - the whole script
Nonetheless it works great - been using it for a month myself. Hopefully it helps a few others out there as well. :)
Coppermine Anti-Copy Mod (http://www.pftq.com/Coppermine_Anti-Copy/)
Here it is working on my own site: Gallery (http://www.pftq.com/gallery/)
Currently I have the following set up on the mod:
- Basic Protection: Overlay a blank image over all pictures (prevent right-click copying)
- Hiding Links: Pass all picture addresses through an image-generating file:
--* Requires random code from server to generate an image.
----* Random code generated from timestamp + offset from any resource of your choosing
--* Optional caption on generated images.
--* Optional resizing on the fly.
--* Image-generator and its features usable independently from mod and gallery (see CUSTOMIZATION)
- For those with Apache: Deny access to files
--* Deny direct access to all image files (specify types in .htaccess file)
--* Forward those who find the images to a page of your choice.
--* Allow you to rename the image-generating file to any name and extension.
- Copying Permissions: Specify specific users and groups to allow copying
--* Enter the user id # or group name into the Gallery Description or Album Password Hint
--* Seperate with commas, no spaces (unless part of group name)
--* Place a negative in front to deny. ex -1, -banned
--* Denying has priority over allowing.
--* Optional removal of caption for those allowed to copy, see CUSTOMIZATION
- Extra features I added to my own gallery and am too lazy to undo:
--* Categories with no visible albums (to the user) and no thumbnail/description become hidden from view.
--* Videos default to 640x480 dimensions
--* Non-image files can now use custom intermediate images if uploaded (default normal_ prefix)
Hey pftq,
Sorry but my Firefox 2.0.0.6 can copy all your pix ;)
In IE 7.x, Full size pix did'nt show nothing (red cross) ! ???
PYAP
Hmm IE 7 shows the picture fine over here... Could you try again? Maybe the server just died for the moment. lol
Yeah, I'm aware FF can save backgrounds (it was a problem before) but I believed I fixed that. Are you using right-click or digging into cache? :P
Ok I just tried with FF 2.0.0.6 and I can't right-click for the picture.... Hmm can you double check? I might have been changing the script around and testing it on my site at the time.
With Firefox 2.0.06, Right click and "Copy Img URL":
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.pftq.com%2Fgallery%2Falbums%2Fuploads%2Fyosemite%2Fthumb_DSC01767.JPG&hash=c5f6552a2919c8a37713e4369beaf09f246b141e)
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.pftq.com%2Fgallery%2Falbums%2Fuploads%2Fyosemite%2Fnormal_DSC01767.JPG&hash=9d0cdc791a78b07af72f6f7f8406504eafadb23b)
Full size pix URL :
http://www.pftq.com/gallery/albums/uploads/yosemite/DSC01767.JPG
PYAP
I cannot find that url anywhere in the source. ??? lol I think you may have accessed it the same time I was editing the gallery (hence the mod was down). I will leave my gallery be for the next 2 hours or so. :P
The good news I guess is that the link does not work.
Maybe I missed it but what page did you find the url on? (all urls should be hidden to some extent)
Hum,
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.pftq.com%2Fgallery%2Falbums%2Fuploads%2Findependance%2520day%2Fthumb_DSC01494.JPG&hash=6033f65e5b2c40f33d0a918786aec040cb0b5685)
I try just at this minute !
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.pftq.com%2Fgallery%2Falbums%2Fart%2Fpftq%2Fthumb_random.png&hash=132b6f99e5b41ebf947d5646cfe741cc242b9226)
It's the same for full size pix and intermediate
.
PYAP
Bah.. I don't quite get it. I can't even find those urls in the page source... (the site should be serving to a different file). Are you sure you refreshed? Do you think could perhaps save the page source and send it to me (http://www.pftq.com/contact/)?
Or actually attach the text file here - seeing as we're allowed to.
@pftq: thanks for your contribution, but I'm afraid that this mod will need some more tweaking. I'm looking forward to see this fully functional.
Quote from: PYAP on August 03, 2007, 10:47:01 PM
With Firefox 2.0.06, Right click and "Copy Img URL":
Confirming Pascal's test (using FF2).
@all: warning - this mod is a resource hog. If you apply it, you better prepare having to talk to your webhost pretty soon for extraordinary resources consumption.
Thanks for the confirmation but I'm unable to reproduce the result here. ??? Using the latest FF2 as well. When I right-click copy Image or URL, I only get the blank image.
Could you please attach the page html code in a text file? The URLs you guys have given me should not exist at all so I'm curious (PHP is serverside so I'm not sure why FF makes a difference).
Output taken from http://www.pftq.com/gallery/displayimage.php?pos=-528 and attached
Aha I see now. The language setting you have messed up the mod a bit. (I used a search expression only for A-Za-z0-9). Thanks - that's exactly what I needed to know. :)
Can you try now? Do you get a replaced url to a blank image file instead? It'd be great if you can attach the source again thanks.
I've changed the regex expression so it looks for the end bracket > instead of looking for possible contents of the tag (didn't consider other language characters before).
By the way - how does coppermine check the language if I may ask? Changing the language setting on the browser does not seem to affect the gallery language.
Quote from: pftq on August 17, 2007, 11:08:13 AM
Can you try now? Do you get a replaced url to a blank image file instead?
Yes, works as expected now.
Quote from: pftq on August 17, 2007, 11:08:13 AMIt'd be great if you can attach the source again thanks.
See attachment
Quote from: pftq on August 17, 2007, 11:08:13 AM
By the way - how does coppermine check the language if I may ask? Changing the language setting on the browser does not seem to affect the gallery language.
3-step fallback mechanism, explained at http://coppermine-gallery.net/demo/cpg14x/custom_language.php or http://documentation.coppermine-gallery.net/languages.htm#how
Delete all files but english.php from the lang folder if you want to get rid of other languages entirely.
Ah ok. Well thanks. Glad it works now - hopefully will figure something about the resource consumption in the near future. Not sure what's up with that but I will take a look when I have time.
Well, I've been searching a bit. Maybe someone can clue me in but as far as I've been able to find, image functions in PHP take up lots of resource regardless what you code. The only way I see to avoid resource consumption would be to remove serving images thru PHP (and thus, "unhiding" the URLs from the page source). If there are any requests for removing it, I can make it optional. Otherwise, there doesn't appear to be any other way.
I would like to install this mod, but I can't risk it being a resource hog because I plan on having a ton of connections to my site at once :-\
There's no risk: as with all mods, you're suppossed to perform a backup of your files before you start modifying them. This being said: apply the mod - if it later turns out that it is consuming to many resources, you can savely undo it.
In fact we would welcome to see this mod applied on a busy site: your feedback (as the owner of a busy site with this mod applied) would be very welcome. After all, my remark on the mod being a resource hog is based on viewing the code, but not on actual experience with it. Therefor, a "live report" would come handy.
If you decide to apply the mod and give us your feedback, your report should include:
- a link to your gallery
- a non-admin test user account if needed to access your page
- Some stats about your daily average traffic and the peeks
- Details about the server resources
Yes as always, back up your site. Unfortunately, I was not able to find any other way to achieve this without using a high number of resources. Apparently from what I've read and tried, using any PHP image functions will use a lot of memory (depending on the size of the image).
I could create a version without using image functions but then all you'd have is the transparent gif overlay. A mod that does that already exists if I recall correctly (search transparent here).
Prevent downloading of pics - transparent gif overlay (http://forum.coppermine-gallery.net/index.php?topic=33782.0)
Quote from: pftq on August 03, 2007, 12:54:41 PM
--* Non-image files can now use custom intermediate images if uploaded (default normal_ prefix)
I haven't gotten this part to work at all. I can't see in the files provided where you would have coded this change. Are you certain you included the correct file for this?
It works basically like uploading a thumbnail for videos/files, except you use the normal_ prefix instead of thumb_.
This does not apply to videos (no image overlay before video plays) - that requires a flash player. This is in reference to having a picture to click on instead of a plain file-icon when hosting zips/documents etc.
Quote from: pftq on October 18, 2007, 05:31:12 AM
It works basically like uploading a thumbnail for videos/files, except you use the normal_ prefix instead of thumb_.
I assumed that. I uploaded a normal_ and thumb_ file, but only the thumb_ shows as intermediate image. And I can't find anywhere in your code that it should display the normal_ file for the intermediate. so that's why I asked if you were sure there wasn't another change that maybe didn't get included in this package. :-[
Even though I know it's not the major feature of your mod, this is the part that interests me most because I don't like the little thumbs used as intermediate images.
i guess i can't edit my post, but wanted to add that I tried on a .zip file
The feature is in the imagix.php (root one). It replaces the theme_html_picture() function with a modified one. However, if an updated one already exists in the theme.php, it will be ignored.
You probably have the function in your theme.php - if you don't mind, removing it should fix the issue. Or you can add the change yourself:
Find: elseif ($mime_content['content']=='document')
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
if(file_exists(str_replace($CONFIG['thumb_pfx'], $CONFIG['normal_pfx'], $pic_thumb_url))) $pic_thumb_url=str_replace($CONFIG['thumb_pfx'], $CONFIG['normal_pfx'], $pic_thumb_url);
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
$pic_html=imaginx($pic_html);
}
you are right. that was exactly the help that i needed. thank you very much. :)
Slight problem with the mod I discovered recently. The mod seemingly just stop working for no apparent reason and reduce the image view size to 1×1px.
The cause turned out to be the filepath of the image, which might contain a space but shows up as %20 from the URL. The code does not know how to handle this and renders a faulty image.
This has been corrected and the download has been updated. For those who have the previous version, simply replace the root imagix.php (not the theme one).
Download: Coppermine Anti-Copy 1.02 (http://www.pftq.com/Coppermine_Anti-Copy/)
Apologies, but I still haven't been able to get around the resource consumption. The mod is based entirely on the PHP image functions, which by nature seem to use heavy amounts of memory (directly proportional to the size of the image itself; smaller images = less memory use). If anyone has any tips on how to around this that'd be great.
Hi all,
I want to install your great Mod on my site (www.volleyball.lu/fotogallery/) but I tested it on an offline version of my gallery. There was the problem that no image was shown at all, even Tumb, Itermediate, an Fullsize.
Could someone give me a hint or more detailed instructions how do this Mod?
Thanks in advance. Regards, Francis
Hi is the size of the image correct? Describe a bit more what you mean.
If the sizes are correct and it is only the image which is blank, try raising the time setting on the image generator file (one with really random-lettered name) as this means the image generator is having too narrow a timeslot for your server to extract the image.
It'd also help if you could set up a seperate temporary gallery to show what problems you are experiencing.
Hi, infact the image size should be correct (e.g. the thubs are schon 150x100px) but the original image in background isn't shown at all.
Do you mean this ($marx=15;) variable?
For the moment I have jhust one CPG install in production. I will try to macke a copy.
Thanks
Hi, I prepared a test CPG gallery with your mod. you will find it under test.volleyball.lu. There is the same phenomen. Maybe this will help.
Thanks for your time.
Hi sorry for the delay.
Does your server support Apache? It appears that the image generator file (random-looking extension) is not being recognized as a jpeg filetype.
Quote from: pftq on January 18, 2008, 10:25:12 PM
Hi sorry for the delay.
Does your server support Apache? It appears that the image generator file (random-looking extension) is not being recognized as a jpeg filetype.
Hi, no problem. I think the server supports Apache. I found in the phpinfo following line:
Server API Apache 2.0 HandlerThere are also a lot of parameter under the point
apache2handler and
Apache Environment.
But what they all means, no idea ???
Francis
You should not have to change anything then... The code that lets your server recognize the filetype is in the .htaccess file in the albums/ folder. Maybe you forgot to copy it over?
Quote from: pftq on January 19, 2008, 10:04:11 PM
You should not have to change anything then... The code that lets your server recognize the filetype is in the .htaccess file in the albums/ folder. Maybe you forgot to copy it over?
Hi, I copied the file in the albums location. If I try to enter the URL for a pic under albums, I get with te htacces file a 500 server error. If I delete the htacces I can acces this file. So it seams that the htacces works.
Hi, try copying the .htaccess to the root gallery folder as well.
Quote from: pftq on January 20, 2008, 09:45:51 AM
Hi, try copying the .htaccess to the root gallery folder as well.
done but now I get when access the page an 500 error
Can I see the code you put in the .htaccess file?
Quote from: pftq on January 20, 2008, 10:07:32 AM
Can I see the code you put in the .htaccess file?
#Set your site to recognize your custom php file, if you change the extension
AddType application/x-httpd-php .jfASjaweaxSPAt
AddHandler application/x-httpd-php .jfASjaweaxSPAt
#Deny access to image files for those who figure out the code
RewriteEngine on
RewriteBase /gallery/albums/ #Path to pictures
RewriteCond %{HTTP_HOST} !^http://(www.)?sitename.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?sitename.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://12.34.56.7890/.*$ [NC] # This is site ip address, optional
RewriteCond %{REQUEST_URI} ^.*\.(gif|GIF|jpe?g|png|JPE?G|PNG)$
ReWriteRule (.*) /404 [L] # Where to send those snooping bastards...
Yes, you have to change the settings to match your site.
Example: sitename.com would actually be the name of your site
/gallery/albums/ should actually be the path to your albums folder.
I cahange it to
#Deny access to image files for those who figure out the code
RewriteEngine on
RewriteBase /albums/ #Path to pictures
RewriteCond %{HTTP_HOST} !^http://www.test.volleyball.lu/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.test.volleyball.lu/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://12.34.56.7890/.*$ [NC] # This is site ip address, optional
RewriteCond %{REQUEST_URI} ^.*\.(gif|GIF|jpe?g|png|JPE?G|PNG)$
ReWriteRule (.*) /404 [L] # Where to send those snooping bastards...
But no result.
The IP address also has to be fixed, but let's focus on one issue at a time.
It's possible your server is not allowing the filetype to be added for whatever reason. You can try adding the filetype extension .jfASjaweaxSPAt with MIME: application/x-httpd-php if you know how.
Otherwise try changing the extension of the jfASjaweaxSPAt file to .php instead and change it accordingly in the other files.
Remove the .htaccess files altogether and let me know what happens.
So I fixed the IP Address... Nothing changed
so now I changed the extension to .php and also changed it in imagix.php (included in themes).
Result, the pics are now shown on the site.
This are the good news but if I can access the file while typing the URL. But this is the main fuction I need.
If you want, I can you give access to the test site ... Just let me know, so I can send it by PM.
You can still hide the original files with the htaccess. I just wanted to isolate the issue first.
But since the filetype does not get added anyways, you can remove the lines in the htaccess above:
#Deny access to image files for those who figure out the code
Have only one copy of the .htaccess, which should be in albums/ as originally.
jep this is good. Thanks a lot.
I let a copy of the htacces file in the album directory. I also change the "active" htacces to:
#Set your site to recognize your custom php file, if you change the extension
AddType application/x-httpd-php .jfASjaweaxSPAt.php
AddHandler application/x-httpd-php .jfASjaweaxSPAt.php
Now it seams to work. Maybe you can double check this. Great thanks!
why on my page, in firefox thumbs are shown good, and in IE7 its shown a blank images (image.gif) ?
thanks for reply :]
A link to your gallery would help. ;)
Do you see the same problem on my gallery here? www.pftq.com/gallery/