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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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.

djboxny

well tried to possition the watermark on the bottom of the pictures so i changed southeast to northwest but din't work at all.  it stays at the top left corner.  the link is www.djboxny.com/gallery1

flex

Northwest would be the top left corner of the picture anyway...

North = top
Northeast = top right
East = right
Southeast = bottom right
South = bottom
Southwest = bottom left
West = left
Northwest = top left

flex

Quote from: "bshrdr"Well, I took this cool little hack a step further.  Instead of creating a PNG offline (which was no real problem - it just didn't suit my needs), I wanted to just use plain old text.  So I came up with this, which creates a small PNG on the fly.  

Nice work! I had considered doing something similar but now there's no need! I think this would be a great way of putting watermarking into coppermine since you control it all from the control panel, instead of having to upload images etc.

The one thing I did look at was trying to use different fonts for the text, but I didn't get very far with the GD/Imagemagick functions for this...

djboxny

It is at southeast and still appears at the top left no matter to what i change it too.  this is the code i have inplemted<?
define('IN_COPPERMINE', true);
require('include/init.inc.php');

header('Content-Type: image/jpeg');
header('Content-Disposition: inline; filename=file.jpg');

$pid = $_REQUEST["pid"];
$mode = $_REQUEST["mode"];

$sql = "SELECT * FROM ".$CONFIG['TABLE_PREFIX']."pictures WHERE pid=$pid";
$db = mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
mysql_select_db($CONFIG['dbname'], $db);


$result = mysql_query($sql, $db);
$row = mysql_fetch_array($result);

$pic_prefix = array(
    'thumb' => $CONFIG['thumb_pfx'],
    'normal' => $CONFIG['normal_pfx'],
    'fullsize' => ''
);


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

passthru ($cmd, $output);

echo $output;
?>



is this correct

flex

Hmm that's very strange, it all looks ok to me... By default gravity is set to Northwest but I have no idea why it's not working when you set it to Southeast...

Any ideas what version of imagemagick you're using? I guess it could be a bug with an older version...

golf16vkr

Is it possible to but the logo's in for outside linking ?

I have searched the board but it's not quite clear to me.

I hope this is not seen as spamming and someone can help me out.

Thanks in advance

FreeMail

Quote from: "flex"Ok I've created a generic coppermine watermark for those having trouble creating one in photoshop/paintshop pro and don't want to use the one I posted (obviously).

I'm still looking at the thumbnail watermark problem.. just takes a while for my head to get round the code again.

Here's the generic watermark:
http://www.jvcam.co.uk/coppermine/watermark-cpg.png

You'll need to rename it to watermark.png for it to work with the script.[/php]


i tried the watermark-cpg.png file but i get a X mark, any tip on how i can solve this?  :roll:

tia!

flex

Quote from: "FreeMail"i tried the watermark-cpg.png file but i get a X mark, any tip on how i can solve this?  :roll:

Ok you can try editing wm.php to echo the imagemagick command to see if it's constructing it correctly.


<?  
define('IN_COPPERMINE', true);  
require('include/init.inc.php');  

// header('Content-Type: image/jpeg');  
// header('Content-Disposition: inline; filename=file.jpg');  

$pid = $_REQUEST["pid"];  
$mode = $_REQUEST["mode"];  

$sql = "SELECT * FROM ".$CONFIG['TABLE_PREFIX']."pictures WHERE pid=$pid";  
$db = mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);  
mysql_select_db($CONFIG['dbname'], $db);  


$result = mysql_query($sql, $db);  
$row = mysql_fetch_array($result);  

$pic_prefix = array(  
    'thumb' => $CONFIG['thumb_pfx'],  
    'normal' => $CONFIG['normal_pfx'],  
    'fullsize' => ''  
);  


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

echo $cmd;

//passthru ($cmd, $output);  

//echo $output;  
?>


Try that and then call the image directly on one of your images. I tried looking at your gallery but it seems your having a few account problems with it, so let me know when you've done the above editing and we'll try get this sorted out.

Flex :)

FreeMail

thanks for the tip!

my webhost got hacked by one of its subscriber! sigh!  :lol: everything wiped out according to the webhost!

djboxny

Let us know what hosting company your are with so we don't go to that company and get hacked too :roll:

jamaman83

I did all the stuff in the hack but i get X when viewing normal or full sized images, when i launch the wm script by itself with the correct options it just returns a value of 1.

Pleas help thanks

smidge

Hi Flex/Gaugau, I love the script, it works beautifully for me. I was just curious about a quick addition.

Is there a way to turn off the watermark if the image was uploaded by a user? Seems like it would just be a simple if-then statement in there but I don't know anything about php or the variables for the users.

I only ask because my brother got upset when he saw my watermark on his pictures.

And another nice feature would be to specify the watermark by which user the picture belongs to. But I don't really care about that for now.

If you don't have time, could you just give me the variable for users in general and I'll fool around with it? Thanks.

http://www.tedesigns.org

hyperion

&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

jerx

Hello,

I would like to use slideshow and ecard function, but those pictures have no watermark. I think you have to modify slideshow.inc.php and ecard.php. Can anybody help me?

Thank you in advance,

jerx

smidge

Quote from: "hyperion"This thread should give you some ideas.

http://forum.coppermine-gallery.net/index.php?topic=3269

Hi hyperion, thanks for the reference. I've actually already looked at that thread before but can't really make out anything. What does $user1, $user2 etc. refer to?

I don't want to implement that code because I would have to go through all of my pictures (almost 900) and individually add the watermark. I tend to batch upload large numbers of pictures at a time as well. If I could just get this code to check and see if the picture was uploaded by a user, that would be great.

joko

I have made some modify for VIDEO-hack.

Find in include/function.inc.php

                return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);


replace with

                if (is_image($pic_row['filename'])) {
                        if((($mode == "normal") || ($mode == 'fullsize')) && ($CONFIG['thumb_method']=='im')){

                                 // return the url to the wm script
                                return "wm.php?pid=".$pic_row["pid"]."&mode=".$mode;
                        }else{
                                // it's a thumb, don't bother wm'ing
                                return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);

                        }  
                } else {
                return $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
                }                


That's will ok for VIDEO-hack.

ps:I have test this with video-Full package.

cem

Quote from: terrorhawk on November 13, 2003, 05:51:08 PM
Hi there..

i was trying to add the watermark hack but when it wants to open the pic in full size (so not the thumpnail) i get a X (image not found).
and i dont have any iedea what this could be.

please help..
if you need the files i changed just ask and i mail

Same here and also noticed others have the same problem.. Did you manage to find/fix the problem??

loudone

This works great! It is just what I needed! Anyone have input on the slideshow view? It makes it load real slow now.

shutiri

great...  it's working fine. thank you.

Does anyone knows how to center the wm just in the middle of the image ?

I saw this:
QuoteNorth = top
Northeast = top right
East = right
Southeast = bottom right
South = bottom
Southwest = bottom left
West = left
Northwest = top left

But I would like to have it just in the middle.

thank you.
shutiri.



loudone

When a user views a full size image, how would you make the watermark larger??  Fits perfect in intermediate view....


Thanks