Home > Backend Development > PHP Tutorial > PHP transparent watermark generation

PHP transparent watermark generation

WBOY
Release: 2016-07-25 08:42:16
Original
952 people have browsed it

[PHP] code

  1. /*
  2. * Created on 2010-10-27
  3. * BY QQ542900563
  4. * Copyrights Reserved 2000-2020
  5. * This example demonstrates how to generate image watermarks
  6. */
  7. //Load separately Two pictures
  8. $im=imagecreatefromjpeg("liu.jpg");
  9. $img2=imagecreatefrompng("m.png");
  10. //Get their respective length and width, calculate the position
  11. $im_WH=getimagesize("liu. jpg");
  12. $im_W=$im_WH[0];
  13. $im_H=$im_WH[1];
  14. $img2_WH=getimagesize("m.png");
  15. $img2_W=$img2_WH[0];
  16. $ img2_H=$img2_WH[1];
  17. //Define the storage location
  18. $NewX=$im_W-$img2_W;
  19. $NewY=$im_H-$img2_H;
  20. //Fill
  21. imagecopy($im,$img2, $NewX,$NewY,0,0,$img2_W,$img2_H);
  22. header("Content-type:image/jpeg");
  23. imagejpeg($im);
  24. ?>
Copy code
php


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template