国产探花免费观看_亚洲丰满少妇自慰呻吟_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. ?> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 海兴县| 休宁县| 平谷区| 鄯善县| 呈贡县| 陆川县| 临夏县| 津南区| 甘孜| 吉木乃县| 岢岚县| 天峻县| 化州市| 牡丹江市| 宁海县| 博客| 盐山县| 德江县| 北安市| 湘阴县| 威信县| 沈丘县| 县级市| 黑河市| 道真| 信阳市| 普宁市| 淮滨县| 郎溪县| 镇赉县| 满城县| 芷江| 吐鲁番市| 黔江区| 仁布县| 南汇区| 东平县| 淮阳县| 姜堰市| 任丘市| 汨罗市|