当前位置:Gxlcms > PHP教程 > 图片上写入中文或水印

图片上写入中文或水印

时间:2021-07-01 10:21:17 帮助过:3人阅读

其实就是水印啦
  1. //session_start();
  2. header("Content-type: image/png"); //声明图片
  3. //$image = imagecreate(417, 294); //创建图片大小
  4. $image = imagecreatefrompng("cj.png");
  5. $admin = imageCreatefrompng("admin.png");
  6. $wfilew=imagesx($image);//取得图片的宽
  7. $wfileh=imagesy($image);//取得图片的高
  8. $waterw=imagesx($admin);//取得水印图片的宽
  9. $waterh=imagesy($admin);//取得水印图片的高
  10. //$imgbg = imagecolorallocate($image,30, 30, 30); //图片背景色彩
  11. //imagefill($image, 10, 10, $imgbg);
  12. $colorBlack = imagecolorallocate($image, 0, 0, 0);
  13. $colorBlacks = imagecolorallocate($image, 144, 144, 144);
  14. imagettftext($image, 20, 0,270, 250, $colorBlack, "simkai.ttf", "吕滔");
  15. imagettftext($image, 12, 0,230, 424, $colorBlacks, "arial.ttf", "420528198602344812");
  16. imagettftext($image, 12, 0,290, 450, $colorBlacks, "arial.ttf", "PHP100-20100001");
  17. imagettftext($image, 12, 0,260, 477, $colorBlacks, "arial.ttf", "PHP100-20100001");
  18. imagecopy($image, $admin, 550, 350, 0, 0, $waterw,$waterh);
  19. //imagestring("2.jpg",2,3,10,$waterstring,$colorBlack);
  20. //$_SESSION['lvtao']=$waterstring;
  21. imagepng($image);
  22. ?>
  23. //$email = 'user@lvtao.net';
  24. //$domain = strstr($email, '@');
  25. //echo $domain; // prints @lvtao.net'
  26. ?>

人气教程排行