Gallery2 provides a module called URL Rewrite. This module also allows watermarking images that are hotlinked (i.e. linked from another site).
By default, your own site domain is trusted. If you set it to not-trust your domain, all images are then shown with the watermark.
Steps:
1. Go to Site Admin
2. Click on Watermarks under Display
3. Select "Hotlink" radio button for the watermark you want to use
4. Install URL Rewrite module
4.a. Click on modules
4.b. Install URL Rewrite
4.c. Activate it
5. Go to URL Rewrite Administration
6. Activate Watermark hotlinked images
7. Save
8. Click on the Setup tab
9. The approved referers already lists your own domain. The code prevents you (or atleast me) from removing it.
10. So there's nothing to do here. (unless you want images to not be watermarked from some domain)
This will add the watermark to your images if some other site displays those images.
To make G2 show the watermark on your site as well,
Open .htaccess file in your G2 directory on your web server.
Look for these lines:
Quote:
RewriteCond %{QUERY_STRING} view=core.DownloadItem
RewriteCond %{QUERY_STRING} itemId=([0-9]+)
RewriteCond %{HTTP_REFERER} !://www\.YOUR-SITE\.com/ [NC]
RewriteRule . /gallery/main.php?g2_view=watermark.DownloadItem&g2_itemId=%1 [L]
And remove, or comment (add a #) the third line to make it:
Quote:
RewriteCond %{QUERY_STRING} view=core.DownloadItem
RewriteCond %{QUERY_STRING} itemId=([0-9]+)
#RewriteCond %{HTTP_REFERER} !://www\.YOUR-SITE\.com/ [NC]
RewriteRule . /gallery/main.php?g2_view=watermark.DownloadItem&g2_itemId=%1 [L]
That should do it.
Note: The .htaccess file will be modified the next time you change some G2 settings. So you'll have to manually do this again.
Posts: 32509
heh, you might want to add this workaround as a howto to codex.gallery2.org .
note; as far as i understand the hotlink watermark feature, it doesn't cache the watermarked image, so they get generated on each request for each image / thumbnail shown. this will drive the server load up and most servers will get extremely slow / unresponsive as soon as there are more than 2, 3 concurrent users.
Posts: 219
Thanks very much for this - I'm sure I'm not the only one who appreciated this. Whether my web-host likes it or not remains to be seen ;)
Posts: 2
Nice post. You've just saved me LOTS of time. THANK YOU VERY MUCH
Given the performance issues associated with this tweak, any idea which would be more efficient: netpbm or ImageMagick? (given that one of them is gonna run every time someone views a pic)
Also, any idea what the ETA on a real bulk watermarking feature is? I see it's been the top rated feature request at sourceforge for some time now.
Thanks again.
Posts: 16504
Probably won't see any new features until at least 2.1 is released. I don't know if the devs are currently working on bulk watermarking or if they are concentrating their efforts on other tasks at this time. Sometime in Jan/2006 or early 2006 we should see G2 2.1
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 22
Thank You. That has been very helpful.
See the fun in Macedonia www.epp.com.mk/gallery2
Posts: 22
Yes it was helpfull.it worked for some time.now my account is suspended
Posts: 22
sorry.please delete extra post.
Posts: 31
This is a great post for bulk watermarking. I am 99% there, but can't find the .htaccess file on my web server? Can anyone help?
Posts: 4
My own personal work-around is to simply bulk watermark my web images in Adobe Photoshop CS2 before I even upload them to the gallery. I just created an action for my copyright and then add it to the photos. That way I know that even if people try to save any of my photos directly from my site, they will have a big fat watermark on them. It makes things a whole lot easier.
Posts: 22
Well, I figured out even a better way. If it helps to anyone. I found a program that does bulk watermarking. So now, I don't have to work on all the photos one by one (in photoshop), but instead all I have to do is click a button and all the photos in a folder get a watermark and reduced quality (less kb).
It works fine. I don't have to worry anymore.