Apply watermark to guests only
|
marcodepolo
Joined: 2008-10-03
Posts: 11 |
Posted: Tue, 2010-03-16 10:27
|
|
Hello, I have a requirement to implement a customization to the watermark system where registered users would be able to access the resize (800x600) without a watermark while guest users would see all images with a watermark. I've been looking around a bit but it doesn't seem like this has been done and I even doubt it's feasible with the current watermark module. Could someone give me a few hints on this ? Do you think it's best to customize the existing module or is it better to create a new one. Does it sound very complicated, should I advise my client against it ? I've also been looking at gallery3 to see if the watermark system would allow something like this but unless I'm mistaken it doesn't seem so. Still, I'm wondering that maybe it would be easier to implement this in gallery3 ? Any help or sound advice would be greatly appreciated Marc Salvetti |
|

Posts: 4338
It's very easy.
Create a resize for each image (or album) at the same size as the original. Apply the watermark to resizes, but not originals.
Give guests "[core] View resizes" permission but not "[core] View original" or "[core] View all versions".
Give the registered users group "[core] View original".
Done.
Posts: 11
Thanks very much for your answer, that'd normally do the trick but here the client wants to sell full sizes, even to registered users so this wouldn't work :/
Any other idea ?
Marc Salvetti
http://iconsulting-fr.com
Posts: 4338
In that case, no, with G2 you're SOL on about three fronts. I have no idea about G3 but generally it's less flexible than G2, although designed to be much smaller and faster.
In detail: the back end of G2 is flexible enough to have as many derivatives of each image as you want, and each derivative can have independent watermarks (or other graphics effects such as crops, stretches or anything else). Unfortunately there's no interface that will allow you easily to access this power.
As far as permissions go - I'm not 100% sure if it's possible to give different permissions to different derivatives; you'll need to do some research actually reading the code and API. If the code allows it, I know there's no interface that will allow you to set it up; you'll have to write one.
If you want to watermark individual resizes, play around with the customderivatives module (that I wrote) that allows you to examine (and alter) the commands passed to the image toolkit for each derivative of an item. To get the hang of it, watermark an image and examine how the derivatives are composited. Then try your own.
It's not the actual watermark module that's the real problem though.
I should add that the obvious solution "hack the code so that guests have watermarks added" or some-such isn't going to work with the G2 API. G2 doesn't record whether a particular derivative is watermarked or not and it's a bitch to find out out if it is. Nor can you quickly add a watermark "on the fly" to a given image, on a temporary basis. G2 records a string that's passed to the image processing toolkit to regenerate any derivative (resize, scale, rotate etc.) and a watermark is created just by inserting a "composite" command into that string. There's nothing special about a watermark in that sense. You'll see what I mean when you play with the customderivatives module.
Posts: 11
Thanks again for the very informative answer. It looks like I'm going to advise the client against going that way, too complicated and so too costly.
Marc Salvetti
http://iconsulting-fr.com