Create watermarks for imagecache

Dimm - October 19, 2007 - 08:08
Project:ImageCache
Version:5.x-1.5
Component:Code
Category:feature request
Priority:normal
Assigned:Dimm
Status:closed
Description

I create watermarks for imagecache.
I change imagecache module to do this.
Now you can:
1. You can use temp layar.
2. You can set background size and color
3. You can merge images and use transparence
4. You can use watermarks (with *.png files)

Link:
http://drupal.ru/files/imagecache.zip
Settings exampes:
http://drupal.ru/files/settings1.rar
http://drupal.ru/files/settings2.rar

I hope to this changes be useful in imagecach module and will be in imagecache2.

P.S.
Sory for my English.

#1

Dimm - October 19, 2007 - 08:33

5. You can set background image.
6. You can copy main image to background often (1, 2,..,10,...100 time) in different place.
7. You can copy many images fom files to background or over main image.

#2

quicksketch - October 20, 2007 - 06:09
Status:active» patch (code needs work)

You'll need to post your changes as a patch for any chance for the changes to be included. http://drupal.org/patch/create

#3

Dimm - October 20, 2007 - 08:41

I create imagecache.patch.

AttachmentSize
imagecache_14.patch17.74 KB

#4

bcswebstudio - October 29, 2007 - 01:22

thanks for this-- checking it out now.
Two little requests:
- please provide a little documentation
- please add a few more items to the prompting help list below "Add a new action.." drop list in imagecache config screen

Will follow-up with other observations if I figure out how to use this cool feature!

#5

bcswebstudio - October 30, 2007 - 02:54

I get it! Or at least I can get my watermark to show. Here's some help to anyone test-driving the watermark for imagecache patch.

Concepts to grasp:
- "image" refers to the uploaded image in imagecache as patched by the above patch
- "templayer" is a server-memory-resident workspace image and can be thought of as a canvas. You define its properties like base color and dimensions before beginning.
- stack operations and images as if layering in photoshop in order of "weight" (or "Bec" in the screenshots at the top of this thread). Crop just the uploaded image by doing that first, or the composited image by doing it at the end.

Steps to get a simple png to overlay an image:
1. upload watermark image to drupal site root files directory
2. get into admin imagecache
- create preset: I named mine "water-thumb" here.
- create templayer: this is the working canvas; set overall output image dimensions, set colors to 0's for black bg, set weight -10
- create scale: scales the uploaded image to desired dimensions; set dimensions, set weight -9
- copy image to templayer (image2templayer): copies image onto the "working canvas"; center, center, 100 alpha, set weight -8
- copy file to temp layer (file2templayer): copies watermark image from file onto the working canvas; filename is relative to files dir, bottom, right, 100 alpha, set weight -7
- swap templayer and image (swap_image_and_templayer): makes canvas the "working image in imagecache"; all operations after this now affect the composited image (like a final crop if you choose).
3. test the imagecache image in a url something like:
http://your-drupal-site/files/imagecache/water-thumb/files/image/viperfish.jpg

Thanks for this great enhancement to imagecache. I look forward to watching (helping?) it reach maturity.

#6

bcswebstudio - October 30, 2007 - 02:55

I have a better grasp of this nifty module now. My opinion: way cool, gonna love the new feature, but it's not module-ready. I would like to help get it there in whatever way I can.

Lacking:
- documentation
- on-screen guides (even just the little help comments that show below form fields)

Question:
- Would it be possible to get temp-layer to always match the dimensions of the uploaded image? As it stands, I get templayer borders around my non-square uploaded images.

#7

Dimm - October 30, 2007 - 05:48

"Question:
- Would it be possible to get temp-layer to always match the dimensions of the uploaded image? As it stands, I get templayer borders around my non-square uploaded images."
Try to use temp-layer scale as 110%.

I have no time now.
I need help to finish this patch.

To do:
1. Upload *.png files.
2. Variable jpg-compression.
3. Integration to http://drupal.org/node/141370 !!!
4. Text watermarks (text make by php-code).
5. Select watermarks image by php-code.
6. If-else action to apply different actions to image.
7. Unlimite number of temp-layers.

#8

BrightLoudNoise - October 30, 2007 - 18:51

This has a lot of potential, I'd propose the following for the action names:

  1. define canvas (templayer)
    Descriptive Text: "Define the size of the working canvas and background color, this controls the dimensions of the output image"
  2. scale (already exists)
    Descriptive Text possibilities:
    • scales the source image, should we suggest that these values should generally be the same size or smaller as the canvas size?
    • Otherwise we could put a recommendation in the canvas description, that it should be larger than the following scale/crop action?
  3. place source image (image2templayer)
    Descriptive Text: "Places the source image onto the canvas for compositing"
  4. apply overlay (file2templayer)
    Descriptive text: "Choose the image you wish to use as an overlay, and position it in a layer on top of the source image."
  5. merge layers (swap_image_and_templayer)
    Descriptive text "Merges all layers, subsequent actions will be applied to the composited image."

Nice to haves:

  • Add ability to upload watermark image from within action.
  • Bundle with a demonstration watermark preset that you can then edit

#9

vipconsult - November 7, 2007 - 14:56

Is there any way to resize the watermark accordingly to the image that is put into ?

Example: Scale the image to 300x300 -watermark =100x100 ; Scale image to 100x100 - watermark scaled automatical to 30x30

Thanks

#10

Dimm - November 7, 2007 - 19:05

imagecache_watermarks_patch v0.12

Features:
1. Watermarks.
2. Text watermarks.
3. You can define same canvas.
4. You can make same copy of source image to canvas (different size each copy of source image).
5. You can make same copy of image from file to canvas (different size each copy of image from file).
6. You can use php code to change same parameters.
7. Replace source image by file (To resize watermark file for example).

Usage:
To overlay watermark:
1. Define canvas
2. Scale source image
3. Overlay: source image to canvas
4. Overlay: file image to canvas (watermark)
5. Return canvas

To overlay text watermark:
1. Define canvas
2. Scale source image
3. Overlay: source image to canvas
4. Overlay: text to canvas
5. Return canvas

To resize watermark and overlay watermark:
1. Define canvas
2. Scale source image
3. Overlay: source image to canvas
4. Replace source image by file (watermark)
5. Scale source image
6. Overlay: file image to canvas (watermark)
7. Return canvas

To strestus
"Is there any way to resize the watermark accordingly to the image that is put into ?"
7. Replace source image by file (To resize watermark file for example).

AttachmentSize
imagecache_watermarks_patch_v012 .zip11.09 KB

#11

Chris Herberte - November 9, 2007 - 04:59

AWESOME WORK!!!
Subscribe. +1 x100

#12

Dimm - November 10, 2007 - 19:48

imagecache_watermarks_patch v0.13

Features:

8. Now you can overlay text watermarks as $node->title and other...
9. It made by pass same variables to imagecach module by adding "?nid=123" string to sourse image path "files/images/foto.jpg"

Usage:
print theme('imagecache', 'my1', "files/images/". $item['filename']."?"."nid=".$node->nid, $node->title, $node->title);

It make code as
href="files/images/foto.jpg?nid=123"
- only first time.
After, if rezult image is made, it make code whithout "?nid=123" as:
href="files/images/foto.jpg"

Usage:
To overlay $node->title watermark:
1. Define canvas
2. Scale source image
3. Overlay: source image to canvas
4. Overlay: text to canvas
Php code(example):

$nid = isset($_GET['nid']) ? $_GET['nid'] : '';
if($nid && is_numeric($nid)){
$node=node_load($nid);
$action['data']['text']=$node->title;
}

5. Return canvas

AttachmentSize
imagecache_watermarks_patch_v013 .zip284.2 KB

#13

dopry - November 24, 2007 - 23:20
Version:5.x-1.3» HEAD

@Dimm,
Awesome work... I really want to integrate some of this into imagecache.. You present some really good ideas especially with the 'canvases' I prefer to think of them as 'layers'... I'm going to have to spend some time reviewing your work and the other watermark patch. this style interface is a little more complicated than I want imagecache to be for this version... I'd prefer watermark to be a simple to setup function.

I'd appreciate it if you could re-roll the patch without all the commented out lines of code... They noise is hard for me to read around.

.darrel.

#14

Dimm - November 26, 2007 - 19:27

@dopry
Ok
imagecache_watermarks_patch_v014.zip - without all the commented out lines of code
I am glad to be useful.

AttachmentSize
imagecache_watermarks_patch_v014.zip283.73 KB

#15

anantagati - November 27, 2007 - 15:36
Status:patch (code needs work)» patch (code needs review)

#16

Tim99 - November 28, 2007 - 09:57

Will that be officially integrated into Imagecache in the near future?

#17

Tim99 - November 28, 2007 - 09:57

Will that be officially integrated into Imagecache in the near future?

#18

MikeyLikesIt - November 30, 2007 - 06:57

Just want to say that this sounds awesome! I probably won't have any immediate use for it, but the potential of this is amazing. Great stuff!

#19

yeeloon - December 11, 2007 - 10:07

Hi!

Can you attached the complete zipped version of this "imagecache watermark" module, as I couldn't get it to work...

Please let me know if this actually can be done?

Thanks.
yeeloon

#20

Dimm - December 11, 2007 - 16:35
AttachmentSize
imagecache_watermarks_v014.zip294.35 KB

#21

Dimm - December 17, 2007 - 05:53

If you use text watermarks and you need to change the text in the picture after updating node then take this code as example and past it to imagecach.module:

<?php

function imagecache_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch (
$op) {
    case
'update':
 
drupal_set_message(t('Delete images in imagecach.'));
 
$presets = _imagecache_get_presets();
 
$path = $node->field_products_image[0][filepath];
  foreach (
$presets as $presetid => $presetname) {
   
$ipath = file_directory_path() .'/imagecache/'. $presetname .'/'. $path;
      if (
is_file($ipath)) {
       
file_delete($ipath);
    }
  }
      break;
  }
}
?>

#22

anantagati - December 17, 2007 - 08:24
Status:patch (code needs review)» patch (code needs work)

I am using patch from #14 and it works good for image watermarks. But text watermarks doesn't work.

1. scale
2. define_canvas
3. overlay_source_image_to_canvas
4. overlay_file_image_to_canvas (or for text: overlay_text_to_canvas)
5. return_canvas

#23

Dimm - December 17, 2007 - 10:00

2anantagati: is font file in "file" directory?

#24

anantagati - December 17, 2007 - 14:50

Yes.

Path to files directory set in admin/settings/file-system is: "files"
Font "arial.ttf" is directly under directory "files".

Otherwise with image watermarks it works nice. I am using Xampp on Windows XP.

#25

Dimm - December 17, 2007 - 20:43

Example.

AttachmentSize
imagecache_example_3.png57.3 KB

#26

jpetso - December 18, 2007 - 01:34
Title:I create watermarks for imagecache» Create watermarks for imagecache

Issue #112539 was marked as a duplicate of this issue.

#27

poilf - December 31, 2007 - 19:21

This thing is totally awesome and should really get into the imagecache module!
But it generates jpegs with very low quality. Is there a way to change the quality settings?

BTW: the Canvas thing is cool, but i think most people just need to put a png over the picture, nothing more. Maybe the usability of this patch will be _much_ more easier if there would be (besides the other actions) one simple action that is called something like "Put watermark image over source image" that does exactly this and you're done. The hassling with the canvas stuff really eated up my time.

#28

poilf - December 31, 2007 - 19:27

one more thing: transparency = 0 means full transparency and 100 means no transparency. Isn't this wrong?
This should called visibility or the numbers should be flipped.

#29

jpetso - December 31, 2007 - 20:07

I believe opacity, not visibility, is the popular term for 100% of non-transparency.

#30

anantagati - December 31, 2007 - 21:32

So I tried one time more text watermark and found that when when 'X offset' and 'Y offset' has values in pixels it works. But when there is for example word 'center' it doesn't work.

#31

psynaptic - January 3, 2008 - 11:13
Title:Create watermarks for imagecache» Excellent feature

This is superb! I have successfully managed to get image watermarking for all product image derivatives on my Ubercart based test site. One thing I also needed to do which was outside the instructions above was to create a non-scaling imagecache preset to apply the watermark to the full-sized image (shown when a thickbox link was clicked).

My test site is using XAMPP on OS X and I will be migrating it to a live site today.

Thanks a lot Dimm! Much appreciated.

#32

jpetso - January 3, 2008 - 12:19
Title:Excellent feature» Create watermarks for imagecache

Don't change the issue title, please.

#33

psynaptic - January 3, 2008 - 15:15

Sorry, didn't realise that's what I was doing. Thanks for pointing it out to me.

Edit: I'd just like to add that I migrated the feature to my live site and everything works wonderfully. I hope this gets included in the imagecache module.

#34

anantagati - January 5, 2008 - 11:04

When watermark file does not exist, images are not generated, but in log is not possible to find reason.

It should write message to log, something like: "watermark.png not found".

#35

psynaptic - January 8, 2008 - 20:40

I found this quite hard to get to grips with so I spent a couple of days getting my head together and have written a tutorial on Watermarking (Ubercart) product images. The tutorial could also be used as a general guide to help users struggling with this. I tried to write it so watermarks were applied in as flexible a way as I could find. Feedback welcome. Hope it helps someone.

#36

Dimm - January 9, 2008 - 04:21

The next version of watermarks will be for ImageCache 2.
When I have free time will be.

#37

dopry - January 18, 2008 - 08:06

Dimm, just so you don't lose hope... This is still on my radar... I haven't included it yet because it is a major change to the way imagecache deals with images... I really want the layering stuff in... I almost feel it is a better fit in imageAPI, but I really need to think about the integration and where it fits exactly and I haven't have time. Is there any chance you will be making it to DrupalCon? It would be awesome to talk about this in person.

.darrel.

#38

Dimm - January 18, 2008 - 09:32

Ok, I will try.

#39

George2 - January 28, 2008 - 16:39

great - thanks. having problems with text watermarks as above. it doesn't seem to convert 'left', 'top' etc into the necessary ints. also, i'd like to see an opacity setting on the text watermark as well. and yes, i agree the label should be opacity and not transparency. 100% transparent is see-through, not opaque :)

this is really great because it allows me to have different watermarks for different presets, so can reuse the same images for different sites.

thanks for something i was just about to start slaving on today!

#40

capitano83 - February 4, 2008 - 12:21

Hi,
guys....great threads !!! :)

But i need help... i need the instructions was to create a non-scaling imagecache preset to apply the watermark to the full-sized image (shown when a thickbox link was clicked).

can everyone help me...plssss?

Best regards,
Max

#41

Dimm - February 4, 2008 - 14:57

1. Make non-scaling imagecache preset to apply the watermark to the full-sized image.
2. Change node.tpl to print thickbox link to images of this preset.

#42

capitano83 - February 5, 2008 - 10:04

Sorry, im a newbie!! :)

Ok for make a non-scaling imagechace preset to apply a watermark full-sized image. :)

But can you explain me (if necessary with an example) the second point????
What can i do with node.tpl????

Tnx a lot,best regards,
Max

#43

Dimm - February 5, 2008 - 16:33

file^ themes/you_theme/node.tpl.php

<?php

foreach ((array)$field_>>>>>image_field_name<<<<< as $item) {
print
'<a href="'. url('node/'$node->nid).'" title='.$node->title.' border="0">';
print
theme('imagecache', 'preset_name', "files/dir_whith_images/". $item['filename'], $node->title, $node->title);
print
'</a>';
}
?>

#44

psynaptic - February 9, 2008 - 11:18

capitano83,

what you have asked is explained in the tutorial: http://drupal.org/node/214454

#45

Dimm - February 19, 2008 - 16:18

imagecache_watermarks_patch v0.15

10. No imagecache if image is not exist.

<?php
function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
if(
$path){
 
$attributes = drupal_attributes($attributes);
 
$var_array = explode("?",$path);
 
$path=$var_array[0];
 
$vars=$var_array[1];
 
$destination = file_create_path() .'/imagecache/'. $namespace.'/'. $path;
  if(
$vars){
  if (
is_file($destination)) {
     
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path);
  }else{
     
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path . '?'.$vars);
  }
  }else{
     
$imagecache_path = file_create_url(file_directory_path() .'/imagecache/'. $namespace .'/'. $path);
  }

  return
'<img src="'. $imagecache_path .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
  }else{
  return
false;
  }

}
?>

11. "Transparency" change to "opacity".

AttachmentSize
imagecache_watermarks_v015.zip332.4 KB

#46

jpetso - February 26, 2008 - 18:09

Arial is copyrighted by Microsoft and can't be distributed together with GPL software. I think that also applies to Impact, but I'm not sure. It would be cool to have a GPL compatible font instead, or just asking the users to upload a .ttf file by themselves.

#47

Dimm - February 27, 2008 - 06:19

to: jpetso
You right.
imagecache_watermarks_v016.zip - without copyrighted fonts.

AttachmentSize
imagecache_watermarks_v016.zip60.11 KB

#48

pingers - March 4, 2008 - 07:15

Just to throw a spanner in the works I just created a watermark patch, before I checked here ... maybe this is just confusing to have another patch to try... but I like the simplicity of my patch. Probably needs some work... but it works for me.

The patch allows adding another filter by which you can use an image as a watermark and specify it's offset. PNG transparency works.

Praise or constructively criticize at your leisure :)

AttachmentSize
imagecache_watermark.patch738 bytes

#49

Farreres - March 9, 2008 - 07:39

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/173759

#50

dman - March 9, 2008 - 09:22

I'm afraid #47 isn't much of a patch. How much criticism can you take? I think the best response is the classic l-user problem description : "It doesn't work".

to be more constructive - the patch you attached contains a single string change and zero functionality ;-)

I'm still wishing for someone to converge on this feature also, but I don't think that the job Dimm has been doing in this thread is compatible with the improved imagecache 'actions' api. I may be wrong, so I'll see if I can get it going.

#51

dman - March 9, 2008 - 09:35

Yeah, OK. Dimms stuff looks impressive. But it's against DRUPAL-5--1-3 , while the imagecache module DRUPAL-5--2 changed the API entirely (to allow for contrib actions like these better).
Shit.
Maybe I'll see if I can port it...

#52

dman - March 9, 2008 - 18:57

OK ... Here's a rewrite of Dimms examples - converted to the new modular API!

I left out the concept of multiple canvasses, and the advanced php code option, as they don't fit in the new way of doing things ...
They could - the advanced code process for example can now be a great help with imageAPI - but it was out of scope for getting this job up and running.
So we now have
- image overlay, inc alpha (watermark)
- image background (frames etc)
- text overlay (copyright)
... and
- solid color base ... because it was the first action I ported hoping it would be easy.

This can now be installed as a helper module to imagecache - but only alongside imagecache 5.x-2
So if you are keen to upgrade imagecache, these functions will work!

In theory. I've not been able to fully test all the corners yet. This was mostly an emulation of existing code. I didn't stop to actually think about better ways of doing things. I'm sure there's a few...

Note - I want this to go towards the imagecache project as a contrib, not a stand-alone.
TODO includes splitting the code off into libraries to lighten it up a bit, but only once the code review is done.

AttachmentSize
imagecache_canvasactions.tar_.gz4.75 KB

#53

Farreres - March 10, 2008 - 10:56

Is this something to path imagecache or you are yet to do some other tasks before it's useful? It would be nice to have it integrated in the next release, be it dev or official.

#54

dman - March 10, 2008 - 11:29

Imagecache 5--2 is in alpha. Up to you whether you want to start using it.
BUT the point is that imagecache 5--2 has split off the actions into contrib libraries, so there's no longer so much pain in 'integrating' new features like this. We should be able to just pick and choose among them.

I think it's useful right now (against the alpha update) but there are a few growing pains - like I just found I need to flush the preset cache on a clean system etc ...
If anyone wants to test the imagecache dev release - first without my additions - and give some feedback ("it works for me") then that dev release version can be promoted to a supported release.
THEN we can test these additions against it and get that rolled in also.

Please, just upgrade imagecache to the 5--2 version (with imagecache_ui and image_api) and tell us it's OK. (in the other issue thread) Based on that feedback, the next rollout can progress.

#55

Dimm - March 10, 2008 - 15:37

To dman: Good work!

#56

Farreres - March 10, 2008 - 16:35

Sorry Dman, excuses, which is this other issue thread to communicate our experiences with imagecache 2 alpha? I am using it right now and it works ok but I would better explain it in the appropriate issue thread.

#57

dman - March 11, 2008 - 01:13
Status:patch (code needs work)» patch (code needs review)

Hm. OK, there wasn't really one.
http://drupal.org/node/232618
Here you go!

#58

sgriffin - March 15, 2008 - 17:24

imagecache_canvasactions requires imageapi and imageapi requires php5 FYI.

#59

sgriffin - March 15, 2008 - 20:44

imagecache replacements #45 or #47 are working great
Unfortunately, the documentation is a bit weird/lacking as well as the interface.
A good tutorial is here.
http://www.ubercart.org/docs/user/2504/watermarking_product_images
For a standard watermark, I did my normal scale as the highest action, and continued to "Add watermarking to full-sized images." listed in the article.
This would be the way to go if you dont have php5, otherwise #52 might work.

#60

sgriffin - March 15, 2008 - 21:17

Another caveat, imagecache replacement does not work with the imagemagick toolkit.

#61

z.stolar - April 15, 2008 - 07:44

Hi,

Can someone summarize the current state of watermarking with imagecache?

There are few issues open, maybe some need to be marked "duplicate" or "closed", so the efforts are better concentrated:
http://drupal.org/node/173759
http://drupal.org/node/184816 (this one)
http://drupal.org/node/212537 (less developed in the watermark direction, but looks good)

Thanks!

#62

dman - April 15, 2008 - 22:23

As noted above. There are working things ready to go, but they've been pending a release of imagecache2.
Extensions to code in flux are painful to folk who are unable to patch.

However I'm currently using the attached module (only minor mods from the same one I converted earlier) successfully to get nice image-overlay and text watermarks.

The call went out for PEOPLE TO TEST imagecache 5--2 so we could call it stable. Then these will be added as contribs (I imagine)

AttachmentSize
imagecache_canvasactions.tar_.gz5 KB

#63

z.stolar - April 16, 2008 - 06:28

@dopry: Can you please put a link to imagecache-2-beta on the project's page, so people know about it (and about the need to test it :-) )?

#64

dopry - April 17, 2008 - 01:59
Status:patch (code needs review)» closed

@all: I've been thinking about this a lot lately... I would really like to see this as a seperate contrib module with package = ImageCache in the .info. Don't let me hold up getting it out. Eventually maybe we can roll it into core, but I have enough to do right now just managing the pipe lining and the modifications to imagecache/imageapi. I added all the actions hooks explicitly so people could build cool plugins to imagecache please use the ability...

I'm going to close this issue with hopes for it becoming it's own project.

#65

dman - April 17, 2008 - 03:02

Absolutely cool with this being its own proj - that's what the hooks are for indeed.

All I want to know is ...

Are you happy with the imagecache v2 API? Is it stable enough for us to now start building on?
That's been the only concern from my POV.

If your only concern is the imageMagick commandline/platform stuff, but the hooks are how you intended tham, then I think we can indeed move ahead.
Dimm and I can open up this as imagecache_layers.module or something.

#66

Dimm - April 17, 2008 - 04:12

Ok.

#67

psynaptic - April 18, 2008 - 16:19

I think this is a great idea. We can have any number of modules dependant on imagecache and choose which to use for specific situations.

#68

avolve - April 19, 2008 - 02:12

I am returning to looking for a watermark solution and might have missed some things in trying to catch up on recent developments.

I just wanted to mention (in case not known), that this breaks a 5.7 install (MAMP, OS X 10.4.11 PPC). All dependencies are installed. I know this is the HEAD version, i just thought i would give it a try.

I can provide a list of modules (not extensive for this test site) if this may help...

#69

dman - April 19, 2008 - 03:21

Describe "this". Do you mean imagecache-2 or the latest additional module attached in this thread?
Describe "breaks" :-}

#70

avolve - April 20, 2008 - 01:03

Perhaps you have identified the issue?? I have imagecache 5.x.1.5 (is v2 required?) and the head version of canvas actions— 'this' refers to canvas actions. By break, it gives a blank page after enabling the module.

I do not think it would be a memory issue as i had previously changed php memory to 200MB.

thx

#71

mir-ink - April 20, 2008 - 01:15

nah nah and NAHH! :)

you watermark in the actual immage.. PS if you look allready lets you do this directly. there is no need for more than that.

check your plug in and do it right.. Its free and easy..

I make textuers for 3d games and ALL have my mark imbeded in them.

I sell them all over the place .. this is not a matter of drupal . its a matter of using the toys right :)

the marks are made in the orginal work see.

Up to you as how to inforce them.

I make verry good ones, and i make them to be used.. watermark YES .. dosent matter the use ..

Mirage (Ranting.. X-fidoOP 226)

PS: Its your hard work.. DO it :)

#72

dman - April 20, 2008 - 03:16

@avolve
So just enabling it on the modules admin page takes down Drupal with no error messages in the log? And Drupal remains down until you remove the module? Is that what you are saying? Even without actually using the imagecache process?

But YES this requires the imagecache DRUPAL-5--2 dev version. That's the one that introduces plugin ability :)

@mir-inc ... WTF? I have a few thousand photos, and an editor who's uploading more from his camera. And had no graphic skills. Adding watermarks individually by hand (if that's what you mean, I can't really tell) is not an option.

#73

avolve - April 20, 2008 - 08:39

@dman I have imagecache 2 installed now and i can see the extra settings for presets. With imagecache 5.x.1.5 the canvas actions module did break the drupal install as you described (sorry for not providing error logs).

Having resolved that, i have noted some issues with watermarks and larger images (even with my php memory set to 200MB in php.ini). The imagecache preset does not get generated. I can get the 'Add Overlay: file image to canvas (watermark)' to work on smaller images (320px wide works).

Any advice on this?
thx

@mir-inc My perception is that this module is designed to negate that a need to manually watermark images prior to upload. You can also make the images available without the watermark as well with (create a separate present, or link to the original image). In this sense, this module is time-saving than watermarking images prior to upload

#74

dman - April 20, 2008 - 09:54

Right now I'm looking at ways to optimize the timeouts etc which are bugging me on my machine. But I've been successfully processing images bigger than 3.5 MB, 2400x1800px

... just not lots at a time. You may be hitting a timeout on your machine.
The image overlay with alpha blending is being done pixel-by-pixel ... which is painful. But this is because I encountered inconsistancies with the gd toolkit imagecopymerge function :(
It's certainly a strain on the machine.
I'm looking for better answers.

#75

jdevries - April 20, 2008 - 15:04

I have upgraded to 5.x-2.0-rc1 and I'm trying to get watermarking working again by using the module in #62. I can successfully enable the Imagecache Canvas Actions module, but I don't appear to have any additional actions in the Imagecache presets. Do I need to take any additional steps that I'm missing to make the canvas actions available?

#76

dman - April 20, 2008 - 16:54

Um, yes.
For some reason, the available actions are being agressively cached ... and although I attempt to 'flush' the list on install, it doesn't seem to work :-{

There is a line towards the top of the imagecache_canvasactions module with a comment about caching. Uncomment the line below it.
(line 44)

<?php
imagecache_action_definitions
(TRUE);
?>

Um, dopry, how did you see that working? I try calling it in the install hook, but I think that's just a bit too soon, as the module isn't actually available yet!
Maybe we could flush it every visit to the imagecache presets admin page?

#77

Dimm - April 30, 2008 - 13:31
Status:closed» active

imagecache_watermarks_patch v0.12

Features:
1. Watermarks.
2. Text watermarks.
3. You can define same canvas.
4. You can make same copy of source image to canvas (different size each copy of source image).
5. You can make same copy of image from file to canvas (different size each copy of image from file).
6. You can use php code to change same parameters.
7. Replace source image by file (To resize watermark file for example).

imagecache_watermarks_patch v0.13

Features:

8. Now you can overlay text watermarks as $node->title and other...
9. It made by pass same variables to imagecach module by adding "?nid=123" string to sourse image path "files/images/foto.jpg"

imagecache_watermarks_patch v0.14

If you use text watermarks and you need to change the text in the picture after updating node then take this code as example and past it to imagecach.module:

<?php
function imagecache_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch (
$op) {
    case
'update':
 
drupal_set_message(t('Delete images in imagecach.'));
 
$presets = _imagecache_get_presets();
 
$path = $node->field_products_image[0][filepath];
  foreach (
$presets as $presetid => $presetname) {
   
$ipath = file_directory_path() .'/imagecache/'. $presetname .'/'. $path;
      if (
is_file($ipath)) {
       
file_delete($ipath);
    }
  }
      break;
  }
}
?>

imagecache_watermarks_patch v0.15

10. No imagecache if image is not exist.
11. "Transparency" change to "opacity".

imagecache_watermarks_patch v0.17
for imagecache-5.x-1.5

AttachmentSize
imagecache_watermarks_v017-imagecache-5.x-1.5.zip66.23 KB

#78

Dimm - May 1, 2008 - 15:21

imagecache_watermarks_patch v0.18
12. If image is not exist you can set default image.
Put this code to "Php code" field in first action (define_canvas).

if (!is_file($source)) {
$path='files/default_image.jpg';
}

AttachmentSize
imagecache_watermarks_v018-imagecache-5.x-1.5.zip66.57 KB

#79

TC44 - May 6, 2008 - 18:58

subscribe

#80

Psicomante - May 15, 2008 - 13:21

If we create image with watermarks, we should find out a way to protect original images and possible presets without watermark, isn't it?

I think we can set some images "protected" from display as without watermark. In association with imagefield, some images can only be available in some preset and not in other.

Anyone is interested?

Sorry for my bad english.

#81

dman - May 15, 2008 - 23:05

I've considered that issue in a recent project. Briefly.
It's much too hard. It's not imagecache's job to make that decision. You have to flag it another way, and then just not call or display the imagecache version for the ones you want to protect. Imagecache is just a pipeline. You ask - you get. Don't want it? Don't ask.

Your _original should always be available, and hopefully unwatermarked. Use your code to decide which derivative or cache preset to display. Based on your own logic. It's straightforward using image.module (just tag it). Dunno about imagefield. That's up to you.

PS, I'm adding another layer effect - underlay/background to this add-on, although it needs work to explain why. Oh ... And I promised to bundle it up into a project for everyone one day didn't I? OK, I'll try this weekend.

#82

stella - May 18, 2008 - 22:10

Is there a version I should use for imagecache 5.x-2.0 ?

Cheers,
Stella

#83

semicolon_jones - May 22, 2008 - 06:08

Stella; I recently updated to imagecache2 on a site-in-progress; I'm just now wrapping up a simple watermarking plugin... it doesn't have any of the funky canvas tricks of dimm's build, but it's good at what it does (or what I've asked it to do thus far.)

Textual overlays are essentially one-for-one with imagecache_wm, just worked into the new 2.0 system.

Graphical overlays are a bit different, allowing selection of origins in both the source and destination images in addition to the x/y offsets. Easy example: selecting the bottom-right for both origins and specifying offsets (-10,-10) results in the bottom-right of the overlay being placed on a 10-pixel margin from the bottom right of the destination.

I propose, even if my system is lacking elsewhere (e.g. I didn't even think about pngs) that this origin/offset system is adopted to replace the original offset/keyword system... it's much more flexible, and strikes me as more intuitive. Even if my math and language need work, the concept is strong.

Note the two underscore-headed functions at the very bottom of the file; they're doing the actual, post-preparatory work until an equivalent is in the imageapi / toolkits.

Thanks again to dimm for all of his original work!

AttachmentSize
imagecache_overlay.zip2.65 KB

#84

Farreres - May 22, 2008 - 16:13

It seems dman had no time to create a project. Could someone else pack everything Dimm has created and let us enjoy the pleasure of installing a new imagecache watermark package? Please :)

#85

dman - May 27, 2008 - 11:32

HERE is an updated roll of both the imagecache watermarks (canvas) actions
AND the color actions (inc alpha effects)
... As stand-alone modules that integrate with imagecache 2 API.

This release was built against
imagecache: DRUPAL-5--2-0
imageapi: DRUPAL-5--1-1

Currently lacking slightly in docs and recipes, but it's been working well for me for a few months.
I'll attach a screenshot to give you an idea how I've been using it.

Yeah, this is worth a project. I'll set it up when I can be bothered fighting with CVS again.

In the meantime THESE WORK. And I guess can now be tested. Most of it will be HOWTOs I think. If anyone wants to share recipes, that'll be cool.

The function names may need to be cleaned up for code convention purposes, but all these actions are prefixed with just 'imagecache_' not 'imagecache_canvasactions_'* because that's too much typing.

It also includes a small patch to imagecache.module that gives you previews of the presets (as seen below). And a little more error-chacking paranoia. You may want to apply the patch - but it's optional.

AttachmentSize
samples.jpg167.04 KB
imagecache_actions.tar_.gz139.98 KB

#86

Farreres - May 27, 2008 - 11:53

REALLY REALLY REALLY THANKS

Now having this with us we can start catching bugs. When you have time you can create the project. Thank you. The images are impressive :) Want to try as fast as possible!

#87

dman - May 27, 2008 - 16:16

ps.
I agree with semicolon_jones that the offset mechanism can be updated a little more.
I had to pull some heuristics to make the text inset a bit also - rather than just 'bottom right' etc, so a better pattern would be good - although I haven't checked the code yet.
Plaintext is a bit cheap-looking however, so I'll be using PNGs with transparency for anything I do ... which means I can pad them out appropriately anyway - so the point is moot for me.

#88

dman - May 27, 2008 - 16:32

Just before I go making anything ...
Is everyone happy with calling the action library project 'imagecache_actions' ? We can add to it as needed.

Oh, and BTW, there's a really cool way to use the watermark to do rounded corners, photo-corners, and possibly even patterned borders. I'll throw up a recipe example sometime.

All we are missing now is ... um, arbitrary PHP code (like Dimms first go had) and maybe rotation. Someone else can do those. :-)
Me, I'll look into using the 'file' parameter to pull some of the functions out into includes. It's a good feature, so I should use it.

#89

Farreres - May 27, 2008 - 17:13

Now that you ask about possibilities for the project name, we are in time to contact the maintainer if this other module http://drupal.org/project/imagecache_colorblend to integrate it all in one big module so we don't have 20 modules for adding one action each, what do you think? It is another recent imagecache-related module.

About the name, I installed the module and I see it is MUCH MORE than just watermarking. It is clearly adding new actions to imagecache, so your name is ok with me: imagecache_actions.

I would like to see your solution to rounded corners. Right now I use rounded_corners module for this.

#90

AntoineLafontaine - May 28, 2008 - 03:43

I think imagecache_actions is a good name, but i wonder if "actions" is a bit too general for people unfamiliar with drupal (aka new users).

I didn't find imagecache as soon as I would have liked when i first got into contact with drupal since its name is not very good at communicating all that you can do with it. Since imagecache is there to stay, I feel that any imagecache_something module could help point in the direction of what imagecache can do and how it is so helpfull by providing more information in it's name. I'll give it a shot and most of my ideas are probably questionnable, but I feel that if we are to discuss about a name, that point should be considered.

here it goes:

imagecache_imagemanipulations
imagecache_manipulations
imagecache_pictureeffects
imagecache_actions_manipulations

Alright, I'm not really happy with all this, but I just want people to think a bit about this before choosing the final name. If a user is looking for image manipulations or picture effects... or something like that, he could get this module in their search result and, by looking at the dependencies, also get imagache, this could help make the world a better place!

Of course, if the name is already in use in the community, imagecache_actions would still be quite suitable.

Hope this helps fuel some ideas.

#91

dman - May 28, 2008 - 04:27

I can't say I'm enamoured by those suggestions :-}

But you make a good point about findability.
Possibly 'actions' is a bit broad, and these days may be confused with the real drupal 'actions' api.

imagecache_processes?

We can keep 'imagecache_effects' in reserve for another set of 'effects' (blur,sharpen,artistic) as seen in image editors. And add it to this project.
Terminology is always going to be a pain here. Even using photoshop or whatever I can never remember which submenu 'levels' is in etc.

The bundle here contains two modules (there is no actual imagecache_actions.module)
The modules are named imagecache_coloractions.module, imagecache_canvasactions.module
Note - not 'layers' neccessarily. Technically it's not true multi-layer manipulation going on there - just overlays and underlays being slapped on the top or bottom in order, always working with just one combined base, flat image.

I think we can get a quick link from the imagecache home page referring to these extended utilities ;-)

Currently there is a small error in the watermark maths when overlaying transparent over transparent I'm aware of. There's also a hidden quirk whereby some (but not all) transparency effects convert the image invisibly from a jpg to a png (to continue allowing trans to work) but that needs documenting. There's a 'flatten' function provided to undo that at the end of the process. Basically needs some write-ups.

#92

AntoineLafontaine - May 28, 2008 - 07:42

Yeah, forget about my suggestions... hehe

But basically the findability was the thing that tickled me.

To tell the truth, processes or actions are quite good names I think, but both words have their meaning open to interpretation I'm afraid... and since effects would be used for another range of modules, I would say stick with actions since it's already been used (even if just in limited fashion) and it could even cover effects if needed. I think that imagecache by itself as a good enough status to bring attention to this module and, lets hope, the opposite will also be true.

Thanks for considering my ideas.

#93

dman - May 28, 2008 - 13:43

Here we go!

Imagecache Actions

I needed to do a few tweaks to imageapi to get transparency working as good as it does now. I'll post them in another issue over there.

#94

AntoineLafontaine - May 29, 2008 - 02:23

Thank you dman for this!

I have been trying it out yesterday for about 3-4 hours. So far, so good. Result are consistent with how I expected it to work and I feel that even without a lot of documentation it is fairly easy to grasp the subtleties by trial and error. I guess that from now on issues will go over to the project page itself.

I almost forgot! Thanks you Dimm for the initial work on this.

#95

avolve - May 29, 2008 - 05:22

Checking back, the results look very very good!

What is the news on processing times? I am hopiing (corectly assuming?) the approach has changed to overcome some of the earlier issues (or is it still pixel by pixel)? My main interest is (for now) in watermarking, though the other actions are very interesting and i can see the potential.

I will report back with any experiences worth sharing.

thanks for all the work put in!

#96

z.stolar - May 29, 2008 - 06:11

I think it's time that one of the brave people who contributed us this long-waited module, will close this issue :-)
There is a new issue queue... http://drupal.org/project/issues/imagecache_actions

Thanks!!

#97

jpetso - May 29, 2008 - 07:00
Status: