Advanced search  

News:

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

Pages: 1 2 3 4 [5] 6   Go Down

Author Topic: Watermarking hack (w/ ImageMagick)  (Read 168051 times)

0 Members and 1 Guest are viewing this topic.

sigepjedi

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
wm.php & hotlinking on windows
« Reply #80 on: June 16, 2004, 05:59:50 pm »

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)

Code: [Select]
<?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]
« Last Edit: June 16, 2004, 08:33:25 pm by GauGau »
Logged

chopperwire

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Watermarking hack (w/ ImageMagick)
« Reply #81 on: June 24, 2004, 01:56:12 am »

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?
Logged

JakeLM

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Watermarking hack (w/ ImageMagick)
« Reply #82 on: June 26, 2004, 11:24:14 am »

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  ::)
Logged

IIIBradIII

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Watermarking hack (w/ ImageMagick)
« Reply #83 on: July 16, 2004, 08:12:12 pm »

Anyone have this working properly on 1.3?
Logged

MGSteve

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Watermarking hack (w/ ImageMagick)
« Reply #84 on: July 18, 2004, 10:08:22 pm »

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.
Logged

kiig

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 141
    • Igel's Journaler
Re: Watermarking hack (w/ ImageMagick)
« Reply #85 on: August 03, 2004, 10:30:39 am »

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
Logged
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

erroneus

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 58
Re: [CPG1.2.1 only]: Watermarking hack (w/ ImageMagick)
« Reply #86 on: August 04, 2004, 03:45:45 pm »

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?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [CPG1.2.1 only]: Watermarking hack (w/ ImageMagick)
« Reply #87 on: August 04, 2004, 04:11:01 pm »

the 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.

When 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
Logged

kiig

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 141
    • Igel's Journaler
Re: Watermarking hack (w/ ImageMagick)
« Reply #88 on: September 21, 2004, 12:55:21 pm »

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.
Logged
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

kiig

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 141
    • Igel's Journaler
Re: Watermarking hack (w/ ImageMagick)
« Reply #89 on: September 21, 2004, 11:54:08 pm »

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")

Code: [Select]
$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)

Code: [Select]
$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.
Logged
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

kiig

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 141
    • Igel's Journaler
Re: Watermarking hack (w/ ImageMagick)
« Reply #90 on: September 22, 2004, 11:55:27 pm »

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.

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

PCGUY112887

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 52
Re: Watermarking hack (w/ ImageMagick)
« Reply #91 on: September 25, 2004, 04:19:01 am »

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...
Logged

kiig

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 141
    • Igel's Journaler
Re: Watermarking hack (w/ ImageMagick)
« Reply #92 on: September 25, 2004, 12:55:05 pm »

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.
Logged
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)

PCGUY112887

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 52
Re: Watermarking hack (w/ ImageMagick)
« Reply #93 on: September 27, 2004, 05:04:30 am »

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!
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Watermarking hack (w/ ImageMagick)
« Reply #94 on: September 27, 2004, 05:19:51 am »

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:

Code: [Select]
if ($whatisit)
{
  ... watermarking code
}
Logged
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

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 52
Re: Watermarking hack (w/ ImageMagick)
« Reply #95 on: September 27, 2004, 05:43:42 am »

:) 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...
Logged

Zeitgeist

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 71
  • I'll Outdrink You.
    • TopDrunks
Re: Watermarking hack (w/ ImageMagick)
« Reply #96 on: October 20, 2004, 09:38:39 am »

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?
Logged
I love GauGau!

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Watermarking hack (w/ ImageMagick)
« Reply #97 on: October 20, 2004, 10:00:40 am »

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
Logged

Zeitgeist

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 71
  • I'll Outdrink You.
    • TopDrunks
Re: Watermarking hack (w/ ImageMagick)
« Reply #98 on: October 20, 2004, 12:05:16 pm »

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
Logged
I love GauGau!

kiig

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 141
    • Igel's Journaler
Re: Watermarking hack (w/ ImageMagick)
« Reply #99 on: October 20, 2004, 01:04:10 pm »

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.
Logged
Kim Igel
http://igel.it (Personal playground) or http://foto.igel.it (Paypal shop-site)
Pages: 1 2 3 4 [5] 6   Go Up
 

Page created in 0.022 seconds with 20 queries.