Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature suggestion: per user watermark #245

Open
andrisi opened this issue Nov 18, 2022 · 11 comments
Open

feature suggestion: per user watermark #245

andrisi opened this issue Nov 18, 2022 · 11 comments

Comments

@andrisi
Copy link

andrisi commented Nov 18, 2022

To use watermarking even more efficiently - eg. discourage copying - it would be very useful to watermark images using personalized watermakrs per user. Could you add support to set the watermark file in the HTTP request? Like an image name from a predefined library? We could set that on server side based on authentication data. Thanks!

@andrisi
Copy link
Author

andrisi commented Nov 18, 2022

...or to be even more flexible, a way for the server to get the image to be used on every use, that is on every time it wants to put it on an image, so different image on different tiles. It could be a command line app supplying them from a pool perhaps.

@zabak
Copy link

zabak commented Nov 20, 2022

We have a use case where only some images should have a watermark so this would help us as well. We have iipsrv behind a proxy that checks for access rights and this proxy could set this parameter (and perhaps also WATERMARK_PROBABILITY and WATERMARK_OPACITY).

@ruven
Copy link
Owner

ruven commented Nov 20, 2022

Could you add support to set the watermark file in the HTTP request?

You mean add support for a parameter like watermark= to each request? Won't your end-user be able to modify the URL and bypass the watermark in such a system?

If this parameter is not public, but is only added between the web server and iipsrv, then in fact it's possible to do something similar already. If you start several iipsrv instances, each with different WATERMARK images or probabilities you can configure your front-end web server to route internally the request either randomly to the different iipsrv instances or based on user or authentication data.

@andrisi
Copy link
Author

andrisi commented Nov 20, 2022

@ruven yes a watermark parameter would be great, and it would be set by some middleware. The temp solution using several servers would not work as we will have tens of thousands of users... 😊 We need a "personal" watermark, like their email address on the images served.

@ruven
Copy link
Owner

ruven commented Nov 21, 2022

Maybe using a HTTP header would be better in this case. Something like "X-Watermark-Image", "X-Watermark-Opacity" etc? Adding this feature, however, would require completely restructuring the watermarking code, so I'll look into this only after the release of version 1.2 of iipsrv.

@andrisi
Copy link
Author

andrisi commented Nov 21, 2022

Thanks @ruven so how about an URL param for now? Otherwise a header is ok too, but really it doesn't matter. You can perhaps add a setting in the config file, to turn on this param, so it is not abused if not handled by a miffleware. Or you mean addig any kind of option is hard now? It's (from an outsider's point of view) pushing the URL param to the watermark filename. Or you preload it and sort of set it in stone?

@ruven
Copy link
Owner

ruven commented Nov 21, 2022

Or you preload it and sort of set it in stone?

Yes, for performance reasons, the current implementation loads the watermark at start-up. Also tiles are watermarked before any other processing is done and are stored in the tile cache - if you have user-defined watermarks, this would need to be changed.

Whether we use a header or URL param to let the server know doesn't make much difference to the final implementation.

@andrisi
Copy link
Author

andrisi commented Nov 21, 2022

Ok, I get it now.

It's a consideration (efficiency) but as we (and perhaps others with similar use cases) have large number of images and lots users but not very high usage, caching and in general efficiency on this level is less important. There won't be many cache hits in this scenario, and a less than ideal performance - loading watermarks per request - is acceptable tradeoff for the security provided by unique watermarks.

Your software is an excellent component in anyway, as it is now, and if the funding arrives for our project eventually I'd be happy to chip in to the development.

@zabak
Copy link

zabak commented Nov 21, 2022

The watermark image could be cached in memcached as well I guess.

@ruven
Copy link
Owner

ruven commented Nov 21, 2022

The watermark image could be cached in memcached as well I guess.

Indeed. Currently memcached can be used to cache requests. If each user sees a different version of the tile, then it will no longer be possible to have a common cache for all users.

@andrisi
Copy link
Author

andrisi commented Nov 21, 2022

My guess in our use case is that users - like within an hour or day - rarely ever request the same image tile as there are so many images. Also that loading and processing the actual tiles is the heavier operation, not loading a watermark file which is just a few hundred bytes. You could also store watermark-less tiles in the cache?

I see you have an analytics package for IIPSRV, so you probably have some real data too, I'm just guessing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants