ElkArte Community

Project Support => General ElkArte discussions => Topic started by: badmonkey on August 20, 2018, 04:06:02 pm

Title: nginx watermark on attachments?
Post by: badmonkey on August 20, 2018, 04:06:02 pm
I'm hoping for a "simple" way to watermark Elk attachment images.  Hardly being a coder, php is not in the cards.  One intriguing possibility is using nginx.  There is an nginx module capable of watermarking jpg/png/gif images. 

https://github.com/intaro/nginx-image-filter-watermark

I've compiled the module in nginx.  It works perfectly on jpg images served from a configured directory.  Cool!!  But would there be any way to use it for watermarking elk attachments?  
Title: Re: nginx watermark on attachments?
Post by: radu81 on August 20, 2018, 05:06:40 pm
For SMF there is an add-on, but I have no idea how to port it to elkarte
https://github.com/realdigger/SMF-Watermark
Title: Re: nginx watermark on attachments?
Post by: badmonkey on August 20, 2018, 05:18:44 pm
Quote from: radu81 – For SMF there is an add-on, but I have no idea how to port it to elkarte
https://github.com/realdigger/SMF-Watermark
 
 Same here.  That would be an acceptable solution, if someone could do that.  Otherwise the nginx module may be the way to go. 
Title: Re: nginx watermark on attachments?
Post by: Spuds on August 21, 2018, 09:54:30 pm
That module should work I think for downloaded images but may not for those that are page loaded or "saved as",  I'm just not sure on those,  I am intrigued though!

Did you try setting the directory to your attachment directory ?  Just curious as to what happened.
Title: Re: nginx watermark on attachments?
Post by: badmonkey on August 21, 2018, 11:33:58 pm
It makes sense setting the location to the attachment directory would work. Since the files are stored as .elk may create a miss as the script expects a .jpg.  Any idea how to work around that? Edit the module source file to include .elk instead of .jpg and recompile? I'm grasping at straws here.  :D
Title: Re: nginx watermark on attachments?
Post by: Spuds on August 22, 2018, 09:58:00 am
Yeah thinking about it since things are run through dlattach functions, we would need to make the changes there  ....  perhaps we could use this module to offload the work, but still need to make the change inside of elkarte itself.
Title: Re: nginx watermark on attachments?
Post by: badmonkey on August 23, 2018, 09:51:48 pm
Sounds like the correct path.  The module works in as far as it will watermark avatars stored in a custom directory.  Would this require significant changes?  Or would it be easier to do it in php? 
Title: Re: nginx watermark on attachments?
Post by: ahrasis on August 24, 2018, 06:14:50 am
I think better stick with what is available for now @badmonkey. Not sure if there is anyone who wants to undertake it.