Watermark 1.3 Watermark 1.3
 

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

Watermark 1.3

Started by zpeek, December 07, 2004, 04:15:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zpeek

Ok Now i got some errors:

Warning: imagesx(): supplied argument is not a valid Image resource in /home/m/public_html/photos/logo.php on line 50

Warning: imagesy(): supplied argument is not a valid Image resource in /home/m/public_html/photos/logo.php on line 51



<?
// SCHIPT BY DJ AXION
// e-mail: DJ@the-expansion.com
// Enjoy this script!
// Altered by Aemege almonare[at]ing[dot]uchile[dot]cl

// Need GD && PHP >= 4.3.0


$logo="../relative/paht/to/watermark.ext";


$datos[foto][tipo]=exif_imagetype($picturename);
$datos[logo][tipo]=exif_imagetype($logo);
$datos[foto][MimeType]=mimetype($datos[foto][tipo]);
if (function_exists("imagegif")) {
$gi["GIF Read Support"] = 1;
}elseif (function_exists("imagejpeg")) {
$gi["JPG Support"] = 1;
}elseif (function_exists("imagepng")) {
$gi["PNG Support"] = 1;
}

// Try to dicide
if ($datos[foto][tipo]) {
  switch ($datos[foto][tipo]) {
     case '2' :
        if ($gi["JPG Support"]){
           $b = imagecreatefromjpeg($picturename);
        } else {
           $image = $picturename;
        }
     break;
     case '1' :
        if ($gi["GIF Read Support"]) {
           $b = imagecreatefromgif($picturename);
        } else {
           $image = $picturename;
        }
     break;
     case '3' :
        if ($gi["PNG Support"]){
           $b = imagecreatefrompng($picturename);
        } else {
           $image = $picturename;
        }
     break;
  }
}
     $bx = ImageSX($b);
     $by = ImageSY($b);

if(!empty($b)) {
  $lm = $b;

  if ($bx > 200)  {  // this ensures no watermark is added to small images (e.g. thumbnails)
  // ADD WATERMARK
     $pos = "bottomleft"; //where is the watermark displayed...

// Try to dicide the Logo Vemos que tipo de archivo es el logo
if ($datos[logo][tipo]) {
  switch ($datos[logo][tipo]) {
     case '1' :






$logoImage=imagecreatefromgif($logo);
     break;
     case '2' :





$logoImage=imagecreatefromjpeg($logo);
     break;



case '3' :



   



$logoImage=imagecreatefrompng($logo);
     break;
  }
}
  // THIS IS THE CODE FOR THE WATERMARK
     ImageAlphaBlending($lm, true) or die ("Could not alpha blend"); // Enable when on GD 2+
     $logoW = ImageSX($logoImage);
     $logoH = ImageSY($logoImage);
     if ($pos == "topleft") {
        $src_x = 0;
        $src_y = 0;
     } else if ($pos == "topright") {
        $src_x = $bx - $logoW;
        $src_y = 0;
     } else if ($pos == "bottomleft") {
        $src_x = 0;
        $src_y = $by - $logoH;
     } else if ($pos == "bottomright") {
        $src_x = $bx - $logoW;
        $src_y = $by - $logoH;
     }
     ImageCopy($lm,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH);
  }
}

if ($datos[foto][MimeType] && !empty($b)) {
  Header("Content-type: $datos[foto][Mimetype]");
  switch ($datos[foto][tipo]) {
     case 1:
        ImageGif($lm);
     break;
     case 2:
        Imagejpeg($lm,'',60); //80 means JPEG quality
     break;
     case 3:
        ImagePnG($lm);
     break;
  }
imageDestroy($lm);
} else {
  // No usable GD image Function ? Ok preventing brocken Images and give back the untouched Image
  Header("Content-type: $datos[foto][MimeType]");
  $fp = fopen($image,"r");
  $fa = fread($fp,filesize ($image));
  print($fa);
  fclose($fp);
}
function mimetype($tipo){



switch($tipo){





case 1:







return "image/gif";





case 2:







return "image/jpeg";





case 3;







return "image/png";





default:







return "";



}
}
   
?>

Tranz

There are multiple watermark hacks. To which are you referring? It would be better if you post questions in the thread discussing the watermark.

Joachim Müller

To back up what TranzNDance said: the djaxion hack was made for cpg1.2.x afaik. You have to understand that modifications posted on the mods board are user contributions which are not integral part of coppermine, so there can be only limited support for mods.

Joachim

zpeek

TranzNDance : you sad that there are some hacks that do what i want?

I need a watermark hack that i can add to image and change later if need.

Nibbler

Search the mods board for them.

I dont think TranzNDance would be particularly sad if you found what you wanted though :)