Watermarking hack (w/ ImageMagick) - Page 5 Watermarking hack (w/ ImageMagick) - Page 5
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Watermarking hack (w/ ImageMagick)

Started by flex, November 10, 2003, 11:50:10 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

sigepjedi

#80
Ive got the wm.php working 100%, and im also concerned about hotlinking to my images which is currently taking place.

Im on a windows box, so the .htacess doenst help me much. Ive read though all the postings about hotlinking and nothing really takes care of my issue.

Im wondering if the users cgi referer can be checked on the wm.php page, since this is driving all image calls. If the referer is contained in the allow list, allow the watermarking and images to be displayed. If it is not, then display either another image, or a more anoying watermarked image.

Is this possible?

Im not too familure with PHP, but this would be easy to do im ColdFusion.

I also found the following online regarding HTTP_REFERER, but cant get it to work. (again not php expert)

<?php
$referrer 
getenv"HTTP_REFERER" );
$imagedir"imx/";
$img $_GET[sid];
$myDomain "mysticalillusionz";
if (!
eregi($myDomain,$referrer)) {
  
$imagepath $imagedir $img
  
$imageinfo getimagesize$imagepath );
  if (
$imageinfo[2] == 1) {
    
$imagetype "gif" ;
  }elseif (
$imageinfo[2] == 2) {
  
$imagetype "jpeg" ;
  }elseif (
$imageinfo[2] == 3) {
  
$imagetype "png" ;
  }else {
  
header"HTTP/1.0 404 Not Found" );
  exit ;
  }
header"Content-type: image/$imagetype);
@
readfile$imagepath );
} else {
header"HTTP/1.0 404 Not Found" );
}
?>

Thanks in advance.

[edit GauGau]
added line breaks to code to increase readability
[/edit]

chopperwire

Help! I changed and added the new files like you mention and when I go to view my images ithey dont show up, all I get is the little white box with an x in it. What did I do wrong?

JakeLM

Hi  ;)
i have tried this hack and works fine!!!
Just a question: someone here knows how to place the watermark in the Border of the image ??
I need to place it just out the image; can i use those settings and option for imagemagick  http://www.imagemagick.org/www/ImageMagick.html ?
I think that the option " -geometry" probabily is the right solution... but can i use it with negative  value ???

Thx  ::)

IIIBradIII

Anyone have this working properly on 1.3?

MGSteve

I hate to ask, but why on earth would you do this per request and not simply watermark the images as they are uploaded, I mean, its not rocket science. Put this hack on a half busy server and you'd kill it.

kiig

Anyone with a working Watermark MOD for version 1.3 ?
I've tried for days without luck... I just thought my server or something was wrong, - but when I did the same thing on my 1.2.1 Coppermine machine, - everything worked.

So I have a problem getting it to work on version 1.3.1. I've no problem with 1.2.1

any ideas ?

Kim Igel
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

erroneus

I'm running coppermine 1.3.1 with GD2, and I tried Karri's hack but came out unsucessful. So I've just decided to wait until the next release which is supposed to have a built-in watermarking feature. This will be sweet. When should we expect the next release anyway?

Joachim Müller

Quote from: erroneus on August 04, 2004, 03:45:45 PMthe next release which is supposed to have a built-in watermarking feature.
Who told you so? I haven't heard from any dev working on watermarking being part of the coppermine core code.

Quote from: erroneus on August 04, 2004, 03:45:45 PMWhen should we expect the next release anyway?
Same answer that is being repeated by open source coders of all projects: "It'll be released when it's ready"  ;).

GauGau

kiig

Has anyone done the Imagemagick wtermarking 'hack' with Coppermine 1.3.2 ? It worked for me with 1.2.1, - but not since upgrading, - and I've just tried it again with a new installation of 1.3.2... no go...

?

Kim Igel.
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

kiig

hmm.... a bit stubborn here, - so I ran through everything a couple of times. It turns out that in the wm.php file, - in the $cmd construction, - on my server, at least, it failed to resolve
realpath("./watermark.png")

$cmd = "{$CONFIG['impath']}composite -compose over -gravity Southeast \"".realpath("./watermark.png")."\" \"".realpath('./'.$CONFIG["fullpath"].$row["filepath"].$pic_prefix[$mode].$row["filename"])."\" jpg:-";

So I hardcoded it to read : (which obviously needs to be changed, - but it's a full path on the server directly)

$cmd = "{$CONFIG['impath']}composite -compose over -gravity Southeast \"/home/e-smith/files/ibays/foto/html/watermark.png\" \"".realpath('./'.$CONFIG["fullpath"].$row["filepath"].$pic_prefix[$mode].$row["filename"])."\" jpg:-";

and it works...


I worked for me, - so it's just a hint to everyone else having problems with this.

Kim Igel.
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

kiig

but it only works when my language is set to English.... not 'danish'' which I prefer for this coppermine installation.

Does anyone have an idea why ?

Kim Igel.

Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

PCGUY112887

Does anyone know how to make this script not take effect to other things like Video's and ZIP's?  Right now I have a bunch of ZIP's uploaded and they are erroring because of this mod...

kiig

Regarding the language problem, - someone suggested removing the trailing blank lines in danish.php (in another thread about batch image uploading), - and removing the empty lines made the batch uplad work (now showing the little icons), - and it also makes this Watermark mod work :-) in danish.
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

PCGUY112887

There has to be a way to modify wm.php to not mess with things that aren't images... I would do it myself but I am not a php person!
Please help?  I really need watermarks but also need ZIP's to work!

kegobeer

There's already an easy way to determine the file type - media.functions.inc.php.  Just include it in wm.php and call the function is_image before the watermarking happens, like this: $whatisit = is_image($filename), where $filename has the path and filename of the file in question.  If it returns true it's an image.  You could wrap the watermarking code inside an if-then statement:

if ($whatisit)
{
  ... watermarking code
}
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

PCGUY112887

:) Thanks
As I was reading your post trying to figure out exactelly what you wanted me to do (me and any language don't get along well) I saw this...

"where $filename has the path and filename of the file in question"
And I didn't quite understand it.  Path and filename to which file?  The ZIP I can't get working?  There are bunches and more would be uploaded by different people...

If someone would be o so kind to post a modded wm.php useing kegobeer's instructions I would love you for the rest of my life :-P
I don't know why but I can totally understand nearelly everything in computers... I just can NOT understand programming languages and 3D proggies... I really need to work at php maybe get myself a book...

Zeitgeist

So ImageMagick, we can't just do a command lime from config menu in Coppermine?

Where can I find a thread about the DJ Axion mod for imagemagick? The links were dead.

Thanks

And does thsi still work with 1.3?
I love GauGau!

Joachim Müller

all available watermarking mods are within this very sub-board named "Watermarking & image manipulation". Mods that don't appear on this board are simply not there, and have never been.

Joachim

Zeitgeist

Well, I just tried this and after reading reports on it not working with the recent ver of coppermine, those were dumbfounded.

I installed it with no modifications and it works perfectly.

You can see it at www.topdrunks.com
I love GauGau!

kiig

yes, - it works, - but with a slight delay... I noticed it on my server, - and apparently you have it too :-), - just a small 1 second lag... but still, - it brings up the question of doing this on-the-fly, - or as a batch-job before uploading images.

Kim Igel.
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)