Hello,

As i'm currently looking to build a gallery with CCK + imagefield and imagecache.

I implemented this watermark feature into imagecache as I think it's the place to go. Putting it in the imagefield module would chance the original and later transformations would be done on the altered version of the image.

Per watermark action you can specify a watermark image and a location for the watermark image in the source image.

The 2 functions image_watermark and image_gd_watermark should in fact go into includes/image.inc and includes/image.gd.inc (drupal v6) but I don't think this can still go into v5 core as this is a new feature. This got already posted http://drupal.org/node/173748 .

Trogie

Comments

dopry’s picture

Status: Needs review » Needs work

one hunk fails after the scale and crop patch. could you re-roll for head?

TallDavid’s picture

Subscribe.

texas-bronius’s picture

Will your patch supersede the existing watermark module which I think doesn't currently play well with imagecache? Is there any hope for us D5'rs?

trogie’s picture

Auch, I didn't see these replies as I did reset my subscriptions recently.

This patch is working for imagecache-5.x-1.4 as you can see on my site: http://www.paraglide.be/albums/ and yes, it's in fact a replacement for the watermark module as that one only works with image nodes but there are not so many features yet as in the watermark module.

I'll have a look soon to patch it against HEAD.

Trogie

philippejadin’s picture

As http://drupal.org/node/173748 is postponed to drupal 7, wouldn't it be better to depend on the watermark module functions and add watermarking capability to imagecache only if watermark module is enabled ?

When (if) watermarking will be in core image.inc, it will be easy to switch the backend and use it instead.

trogie’s picture

One of the problems with the watermark module is that it depends on image node, that is: nodes that got created with the image module. Imagefield and imagecache are in my opinion more general as they serve cck (content module) and imagecache in particular doesn't depend on nodes but somehow recreates and rewrite image _files_.

Extending the watermark module with the imagecache feature is probably more difficult then just adding an extra watermark action.

Until the 2 image.inc and image.gd.inc functions go into core, we can simple add them to the imagecache module providing us the same functionality.

dopry’s picture

Yeah!!! I'd love to have this in HEAD. I need some features to encourage people to start testing the head branch... Most of the major features I want for 2.x are there, I'd love to see some watermark icing as well. Go Trogie!!

.darrel.

trogie’s picture

ok, i'll have a look tomorrow to see what has changed in HEAD. :-)

trogie’s picture

StatusFileSize
new5.89 KB

OK, this patch doesnt hunk against the latest HEAD tarbal and I tested the feature fast.

z.stolar’s picture

Tested with imagecache HEAD version.
The watermarking works fine (thanks!), but IMHO the patch should include also some error handling incase of a missing watermark image or bad format. I added the image in the wrong place and got ugly error messages. A kind message to explain me where I was wrong could have been better.
Also, though not critical, an upload field could help a lot.

Thanks again for this patch.

trogie’s picture

That's right. These checks are on my todolist.

what do you mean with 'wrong place'? you basically only have the nine predefined places, no?

Trogie

z.stolar’s picture

what do you mean with 'wrong place'?

I have a multisite environment and I have a different files dir for each. However I put the watermark png in the global files dir. That's just a stupid little mistake, but a legitimate one (as many mistakes are...) ;-)

you basically only have the nine predefined places, no?

I wasn't aware of the nine predefined places, I thought this is for settings.php only.

philippejadin’s picture

Wrong place = wrong directory on the file system I guess.

The "nine predefined places" are a way to chosse where you want the watermark *on* the image

:-)

talldavid@drupal.org’s picture

Any chance of getting the watermark feature released in a version that does not require the user to install CVS or install a patch?

dopry’s picture

Version: 5.x-1.3 » 6.x-2.x-dev

possibly, but I'd really like to see an option to upload watermark images on the form so users don't have to think about where they store it.... probably similar to how the 404 and 403 images should work in 2.x. I'll try to pop that code out sometime...

Re assigning to head...

trogie’s picture

I'll soon have a look to make the watermarking more 'userfriendly' but currently I'm very busy with too much other things...

jpetso’s picture

Issue #184816: Create watermarks for imagecache has had quite a bit activity recently... any chance to get the efforts merged? (I don't want to close any of them as duplicates by myself, because both have been opened by knowledgeable people with patches attached... trogie, could you maybe repost or merge your patch in the other issue, and close this one?)

Farreres’s picture

Come on, people. There are two different threads offering the same solution. Could someone with the knowledge do something to merge them all and give us finally this feature?

The other thread is http://drupal.org/node/184816, as indicated in the comment above.

dopry’s picture

Status: Needs work » Closed (fixed)

go with http://drupal.org/node/184816 for now.. I'm trying to convince someone to create a module from it...

suit4’s picture

StatusFileSize
new21.25 KB

If someone is interested: I successfully integrated this patch into D4.7.
However, creating a preset in imagecache has a very low performance.

Anyway, this is a cool feature. Nice work!

Willy01’s picture

What about add watermark to video i use VidLogo.It's helps me a lot.