国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php使用imagick給圖片加水印的方法

2024-05-04 21:50:03
字體:
來源:轉載
供稿:網友
  1. <?php 
  2. $image = new Imagick(); 
  3. $image->readImage("original.jpg"); 
  4.  
  5. $watermark = new Imagick(); 
  6. $watermark->readImage("/data/mark.png"); 
  7.  
  8. // how big are the images? 
  9. $iWidth = $image->getImageWidth(); 
  10. $iHeight = $image->getImageHeight(); 
  11. $wWidth = $watermark->getImageWidth(); 
  12. $wHeight = $watermark->getImageHeight(); 
  13.  
  14. if ($iHeight < $wHeight || $iWidth < $wWidth) { 
  15.     // resize the watermark 
  16.     $watermark->scaleImage($iWidth$iHeight); 
  17.  
  18.     // get new size 
  19.     $wWidth = $watermark->getImageWidth(); 
  20.     $wHeight = $watermark->getImageHeight(); 
  21.  
  22. // calculate the position 
  23. $x = ($iWidth – $wWidth); 
  24. $y = ($iHeight – $wHeight); 
  25. //Vevb.com 
  26. $image->compositeImage($watermark, imagick::COMPOSITE_OVER, $x$y); 
  27.  
  28. header("Content-Type: image/" . $image->getImageFormat()); 
  29. echo $image
  30. ?> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 连山| 平南县| 贵州省| 临潭县| 津南区| 武定县| 视频| 资阳市| 萝北县| 弥勒县| 循化| 巫山县| 蕲春县| 鹰潭市| 达孜县| 宿松县| 河东区| 凭祥市| 屯门区| 巴里| 垣曲县| 荔浦县| 玛沁县| 南郑县| 策勒县| 游戏| 博客| 南安市| 靖西县| 禹州市| 托里县| 濮阳市| 望都县| 宽城| 咸丰县| 皋兰县| 和政县| 日喀则市| 如皋市| 东丰县| 沂南县|