Guest User

Untitled

a guest
May 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?
  2. $input = "bild.jpg";
  3. $watermark_file = "sign.png";
  4.  
  5. $size = getimagesize($input);
  6. $width = $size[0];
  7. $height = $size[1];
  8. $img = imagecreatetruecolor($width, $height);
  9. $image = imagecreatefromjpeg($input);
  10. imagecopy($img, $image, 0, 0, 0, 0, $width, $height);
  11.  
  12. $size2 = getimagesize($watermark_file);
  13. $width2 = $size2[0];
  14. $height2 = $size2[1];
  15. $posx = ($width/2) - ($width2 / 2);
  16. $posy = ($height/2) - ($height2 / 2);
  17. $watermark = imagecreatefrompng($watermark_file);
  18. imagecopy($img, $watermark, $posx, $posy, 0, 0, $width2, $height2);
  19.  
  20. header("Content-type: image/jpeg");
  21. imagejpeg($img , "", 100);
  22. imagedestroy($img);
  23. ?>
Add Comment
Please, Sign In to add comment