[ic] Watermarking product pictures

Gabriel Millerd gmillerd at gmail.com
Mon Aug 23 20:27:48 EDT 2004

> If it is something you can make with no troubles I for one would be a
> very happy person. I'm sure that this would be a feature that could be
> integrated into some future version of IC. I can imagine that it is
> something that could come in handy for other users as well as many of us
> would like to protect their work in some way. Stories of ripped pictures
> by a competitor are known by all of us I guess.
> Thanks!

this is adapted from something i use for dynamic sizing and
compression ... email me a gmillerd at qualhost.com if you want me to do
something further. I didnt have time at work today to write this into
a mod_perl module :)


use strict;
use CGI;
use Digest::MD5;
use Image::Magick;

my $clearPath = '../clear'; # keep this out of public reach
my $cachePath = './cache';  # keep this in public reach
my $cacheAddr = '/water/cache'; # this must be the
http://.../$cachePath equivlent
my $cgiParam  = 'image'; # i dont like this either
my $markImage = '/tmp/mark.gif'; # full path (should be transparent
and all that

my %markData  = (gravity=>'SouthEast',  # lots of options possible

my $imageClear = CGI::param($cgiParam) || die ("no image given");
my $imageDigest = Digest::MD5::md5_hex($imageClear) . '.png';

my $tsClear  = (stat("$clearPath/$imageClear"))[9];
my $tsMark   = (stat($markImage))[9];
my $tsDigest = (stat("$cachePath/$imageDigest"))[9];

die ("no real image") unless ($tsClear && $tsMark);

unless ($tsClear < $tsDigest && $tsMark < $tsDigest)
    my $bg = new Image::Magick();
    my $wm = Image::Magick->new();

print CGI::redirect("$cacheAddr/$imageDigest");

More information about the interchange-users mailing list