Page 1 of 1
Help me to watermark
Posted: 2007-08-28T02:08:01-07:00
by nicolass
Hi can enyone tell me what to insert in this part of php code to get watermark on image:
Code: Select all
$exec = $app->cfg['ImageMagick']['path'] . 'convert ' . '"' . $params['file_from'] . '"' . ' -resize x' . $params['need_y'] . ' -quality 70 -gravity ' . $params['gravity'] . ' -crop ' . $params['need_x'] . 'x' . $params['need_y'] . '+0+0 +repage ' . '"' . $params['file_to'] . '"';
Re: Help me to watermark
Posted: 2007-08-28T03:12:21-07:00
by Bonzo
I put some watermarking code in your previous post as you asked then.
Re: Help me to watermark
Posted: 2007-08-28T03:39:22-07:00
by nicolass
yes, but that code not work...and I post new message with "smaller" question...
can you tell me
Code: Select all
exec("convert {$params['file_from']} -resize x{$params['need_y']} -quality 85 -crop {$params['need_x']}x{$params['need_y']}+0+0 +repage -pointsize 10 -font Arial -fill black -gravity South -annotate +0+0 'Rubblewebs' {$params['file_to']}");
but I try to do that and nothing..even I dont get output image?
In your example I will get result new image with 'Rubblewebs' word on it?
I put this in my code with your suggestion:
Code: Select all
$exec = $app->cfg['ImageMagick']['path'] . 'convert ' . '"' . $params['file_from'] . '"' . ' -resize x' . $params['need_y'] . ' -quality 70 -gravity ' . $params['gravity'] . ' -crop ' . $params['need_x'] . 'x' . $params['need_y'] . '+0+0 +repage -pointsize 10 -font Arial -fill black -gravity South -annotate +0+0 \'Rubblewebs\' ' . '"' . $params['file_to'] . '"';
is that ok? maybe is escape code wrong \'Rubewebs\' ?
Re: Help me to watermark
Posted: 2007-08-28T05:22:15-07:00
by Bonzo
The code I posted in your other thread worked for me on my server; I find it a bit hard to read your code with all the ' " and . so I changed it ! Once you get it working you can then put it how you want it.
I am just using convert and I know from another recent post that you may need to use something like user/local/bin/convert depending on how your server is setup.
You can change my code to the example below and it should give you some idea of any errors.
Code: Select all
exec("convert {$params['file_from']} -resize x{$params['need_y']} -quality 85 -crop {$params['need_x']}x{$params['need_y']}+0+0 +repage -pointsize 10 -font Arial -fill black -gravity South -annotate +0+0 'Rubblewebs' {$params['file_to']} 2>&1", $array);
echo "<pre>".print_r($array)."</pre>";
You may get 'Rubblewebs' as the watermark and in that case just remove the '
Re: Help me to watermark
Posted: 2007-08-28T07:02:55-07:00
by nicolass
nothing...
i do this:
Code: Select all
$exec = $app->cfg['ImageMagick']['path'] . 'convert ' . '"' . $params['file_from'] . '"' . ' -resize x' . $params['need_y'] . ' -quality 70 -gravity ' . $params['gravity'] . ' -crop ' . $params['need_x'] . 'x' . $params['need_y'] . '+0+0 +repage -pointsize 10 -font Arial -fill black -gravity South -annotate +0+0 Rubblewebs ' . '"' . $params['file_to'] . '"';
Re: Help me to watermark
Posted: 2007-08-28T12:28:48-07:00
by Bonzo
WHY HAVE YOU PUT -gravity ' . $params['gravity'] back in? If you take that out your code may work.
Code: Select all
$file_from = 'sunflower.jpg';
$need_y = '100';
$need_x = '100';
$file_to = 'nicolass1.jpg';
exec("convert $file_from -resize x{$need_y} -quality 70 -crop {$need_x}x{$need_y}+0+0 +repage -pointsize 10 -font Arial -fill black -gravity South -annotate +0+0 Rubblewebs $file_to");
This works for me.
Re: Help me to watermark
Posted: 2007-08-30T02:30:16-07:00
by nicolass
Work..finaly
tnx guys...
code look now like this:
Code: Select all
$exec = $app->cfg['ImageMagick']['path'] . 'convert ' . '"' . $params['file_from'] . '"' . ' -resize x' . $params['need_y'] . ' -quality 70 -gravity ' . $params['gravity'] . ' -crop ' . $params['need_x'] . 'x' . $params['need_y'] . '+0+0 +repage -pointsize 10 -font Arial -fill black -gravity South -annotate +0+0 WWW.MYSITE.COM ' . '"' . $params['file_to'] . '"';
Can you tell me can I watermark with some image? Can I only replace this word with path to some transparent image or I must use diferent code?