Have an account? Sign in
Login  Register  Facebook
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
[Edit] Add Watermark To Images Using PHP GD

Add Watermark To Images Using PHP GD

   // Load the image where the logo will be embeded into
   $image = imagecreatefromjpeg($_GET['imageURL']);

   // Load the logo image
   $logoImage = imagecreatefrompng("logo.png");
   imagealphablending($logoImage, true);

   // Get dimensions
   $imageWidth=imagesx($image);
   $imageHeight=imagesy($image);

   $logoWidth=imagesx($logoImage);
   $logoHeight=imagesy($logoImage);	 

   // Paste the logo
   imagecopy(
      // source
      $image,
      // destination
      $logoImage,
      // destination x and y
      $imageWidth-$logoWidth, $imageHeight-$logoHeight,
      // source x and y
      0, 0,
      // width and height of the area of the source to copy
      $logoWidth, $logoHeight);

   // Set type of image and send the output
   header("Content-type: image/png");
   imagePng($image);

   // Release memory
   imageDestroy($image);
   imageDestroy($imageLogo);