[Typo3-dev] Suggestion for an image watermark extension
Wengrzik, Andreas
Wengrzik at ewr.de
Wed Jan 12 14:50:51 CET 2005
Hello!
I´ve found this posting for watermarks...
I want to include this option into the lz_gallery, where some $cmd options
are used so far:
/**
* Parse the imageMagick commands
*
* @param array $options: Contains the display (~effects) options.
* @return string A valid string of imagemagick cmdline options
*/
function imagemagickCmdline($options) {
// rotation
if($options['rotation'] && is_numeric($options['rotation'])) {
$cmd .= ' -rotate ' . $options['rotation'];
}
// colors
if($options['colors'] && is_numeric($options['colors'])) {
$cmd .= ' -colors ' . $options['colors'];
}
// swirl
if($options['swirl'] && is_numeric($options['swirl'])) {
$cmd .= ' -swirl ' . - (int) $options['swirl'];
}
// charcoal
if($options['charcoal'] && is_numeric($options['charcoal'])) {
$cmd .= ' -charcoal ' . (int) $options['charcoal'];
}
// effect (enhance, equalize, normalize)
if($options['effect'] != 'normal') {
$cmd .= ' -' . $options['effect'];
}
// gamma
if($options['gamma'] != 1) {
$cmd .= ' -gamma ' . $options['gamma'];
}
// implode
if($options['implode']){
$cmd .= ' -implode ' . $options['implode'] / 100;
}
switch($options['mirror']) {
case 'flip':
case 'flop':
$cmd .= ' -' .$options['mirror'];
break;
case 'both':
$cmd .= ' -flip -flop';
default:
break;
}
if($options['channel'] != 'all'){
$cmd .= ' -channel ' .$options['channel'];
}
if((int) $options['contrast'] < 0) {
$cmd .= str_repeat(' +contrast',abs((int)$options['contrast']));
}
if((int) $options['contrast'] > 0) {
$cmd .= str_repeat(' -contrast',abs((int)$options['contrast']));
}
if(!($options['hue'] == 100 && $options['saturation']==100 && $options['brightness'] == 100)) {
$cmd .= ' -modulate ' . $options['brightness'] . ',' . $options['saturation'] . ',' . $options['hue'];
}
if($options['amplitude'] || $options['wavelength']) {
$cmd .= ' -wave ' . $options['amplitude'] . 'x' .$options['wavelength'];
}
if($options['spread']) {
$cmd .= ' -spread ' . $options['spread'];
}
if($options['solarize']) {
$cmd .= ' -solarize ' . (100 - (int) $options['solarize']) . '%';
}
return $cmd;
}
If i add the -watermark option from the composite part of image magick i get an error.
Which IM function is used by typo3? Only combine??
Martin, you have posted some changes to the core of typo3 it think?
Would this solve my problem with the -watermark option??
If i print the array for an image with some IM option active it looks like
file.
params -modulate 100,100,140
height 405m
width 540m
file fileadmin/gallery/test/1024_3563323537396461.jpg
alttext 1024_3563323537396461.jpg
So, how to extend the params options??
Thanks for your help!
Bye
-sorry for my bad english...
> Jeff Segars wrote:
> > Boris,
> > This feature was discussed last year (and earlier before
> that) and if I
> > remember correctly, it was determined that this would be
> very difficult
> > or impossible due to to the 256 color limitations of PHP
> GD. Doing it
> > with ImageMagick only was not discussed, however.
>
> Wasn't this about digital watermarks? They are supposed to be
> invisible.
>
> Boris is talking about some kind of "stamp".
>
> > Boris Senker wrote:
> >
> >> Those TYPO3 frames gave me an idea... hopefully you don't mind me
> >> posting it here.
> >>
> >> Many sites aim to protect their images by printing a
> semi-transparent
> >> 'something' over the image - a logo, or a site name usually.
>
> I have done something like this for a customer.
>
> The point is to decide when an image ha to be "stamped". For
> simplicity
> we only added the logo for popus and extended only SC_tslib_showpic.
>
> Though to position the logo I had to change
> class.t3lib_stdgraphic.php:
>
> // added optional geometry
> function combineExec($input,$overlay,$mask,$output,$geometry='') {
> if (!$this->NO_IMAGE_MAGICK) {
> if ($geometry) $geometry = "-geometry $geometry ";
> $cmd = $this->imageMagickPath.$this->combineScript.
> ' -compose over '.$geometry.$this->wrapFileName($input).
> ' '.$this->wrapFileName($overlay).' '.$this->wrapFileName($mask).
> ' '.$this->wrapFileName($output);
> $this->IM_commands[] = Array ($output,$cmd);
> exec($cmd);
> }
> }
>
> Masi
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
>
More information about the TYPO3-dev
mailing list