Watermark

Since Opentools.de has now gone away I've created this forum to house FAQs and support for this mod in phpBB2.

Moderator: Experts

Locked
Holger
Posts: 10
Joined: Fri Apr 27, 2007 8:14 am

Watermark

Post by Holger »

Hi,

I have the watermark-addon installed, but I cannot find the instructions anymore.
Can anybody post them or direct me to the instructions?

Thank you!

/Holger
Holger
Posts: 10
Joined: Fri Apr 27, 2007 8:14 am

Post by Holger »

Nobody? :(
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Post by DavidIQ »

Where did you get the add-on from? This is the first time I hear of such a thing for attachment mod.
Holger
Posts: 10
Joined: Fri Apr 27, 2007 8:14 am

Post by Holger »

Hi David,

I got it on the opentools-site from the user "Morpheus".

In posting_attachments.php
After

Code: Select all

				$this->post_attach = FALSE;
			}
		}
	}
I have

Code: Select all

   // 
   // Function modificated by Morpheus to add support for other kind of images 
   // 
   //$filename should be a JPG and $watermark a PNG-24 with alpha transparency. $quality is 1-100 JPG quality on output. 
   function watermark($srcfilename, $newname, $watermark, $quality, $extension) 
   { 
      $imageInfo = getimagesize($srcfilename); 
      $width = $imageInfo[0]; 
      $height = $imageInfo[1]; 
      $logoinfo = getimagesize($watermark); 
      $logowidth = $logoinfo[0]; 
      $logoheight = $logoinfo[1]; 
      $horizextra = $width - $logowidth; 
      $vertextra = $height - $logoheight; 
      $horizmargin =  round($horizextra);
      $vertmargin =  round($vertextra);

      switch(trim(strtolower($extension))) 
      { 
         case "gif" : 
             $photoImage = ImageCreateFromGIF($srcfilename); 

         break; 

         case "jpeg" : 
         case "jpg" : 
             $photoImage = ImageCreateFromJPEG($srcfilename); 

         break; 

         case "png" : 
             $photoImage = ImageCreateFromPNG($srcfilename); 

         break; 

         case "bmp": 
             $photoImage = ImageCreateFromwBMP($srcfilename); 

          break; 

      } 

      ImageAlphaBlending($photoImage, true); 
      $logoImage = ImageCreateFromPNG($watermark); 
      $logoW = ImageSX($logoImage); 
      $logoH = ImageSY($logoImage); 
      ImageCopy($photoImage, $logoImage, $horizmargin, $vertmargin, 0, 0, $logoW, $logoH); 
      //ImageJPEG($photoImage); // output to browser 

      switch(trim(strtolower($extension))) 
      { 
         case "gif" : 
             ImageGIF($photoImage, $newname, $quality); 

         break; 

         case "jpeg" : 
         case "jpg" : 
            ImageJPEG($photoImage, $newname, $quality); 

         break; 

         case "png" : 
             ImagePNG($photoImage, $newname, $quality); 

         break; 

         case "bmp" : 
             ImagewBMP($photoImage, $newname, $quality); 

         break; 

         default : 
            break; 
      } 
       
      ImageDestroy($photoImage); 
      ImageDestroy($logoImage); 
   }
and
After

Code: Select all

		global $error, $error_msg, $lang, $upload_dir;
I have

Code: Select all

      // if ( $attach_config['watermark_active'] ) 
      // { 
         switch( $this->extension ) 
         { 
            case "gif" : 
            case "jpg" : 
            case "jpeg" : 
            case "png" : 
            case "bmp" : 
               // $watermark = $attach_config['watermark_img']; 
               $watermark = "album_mod/mark.png"; 
               // $quality = $attach_config['watermark_quality']; 
               $quality = "75"; 

               $this->watermark($file, $file, $watermark, $quality, $this->extension); 

            break; 

            default : 
               break; 
         } 
      // }
That is not everything ... I am afraid.

/Holger
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Post by DavidIQ »

Try looking through this:
http://www.opentools.de/archive/index.php?t=2599
Looks like you'll have to put together some code and see what works...
Holger
Posts: 10
Joined: Fri Apr 27, 2007 8:14 am

Post by Holger »

Thank you!
On pages 5 and 6 there is the solution!

/Holger
Locked