Download & Extend

Apply watermark during hook_image_alter and prevent double-application of watermark to derivative images

Project:Image watermark
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:kpander
Status:needs review

Issue Summary

This patch does a few things -- some of which maybe should be handled as different patches.

1. Primarily, it changes how we cause watermarks to be applied. This patch implements hook_image_alter from the image module. This seems to be a cleaner implementation than hook_nodeapi. It no longer requires checking for specific image.module node properties or form elements to make a decision as to whether the watermark should be applied.

This also more tightly integrates the watermarking process with rebuilding derivatives. You no longer have to consider the two as separate tasks to perform.

2. An additional check has been made such that if the watermark is enabled on the *original* image size, it will *not* be applied to any derivative image sizes. (This would cause the watermark to appear twice on the derivative images.)

3. The ability to toggle the watermark application during the initial creation of the image node has been removed. This seems to be an odd feature because it's only available upon initial creation and if we later rebuild the derivatives or use any batch application of watermark, the watermark will still be applied. I don't see the real-world use case here but feel free to enlighten me!

Now that I think of it, since the choice to add the watermark during the node creation is now removed, we could also remove the hook_perm() implementation, but I'll do that next assuming anyone is reading this and thinks it's ok to move ahead.

AttachmentSize
watermark_implement_image_alter.patch4.63 KB

Comments

#1

Can someone please review and test this patch? It seems to be far reaching, though some of it is needed.