PHP获取服务器图片并添加水印

该PHP脚本从指定URL下载服务器上的图片,然后在每张图片上添加两个水印,最后将处理后的图片保存到本地。脚本使用PHPExcel库读取Excel表格数据,循环处理每行的图片链接,同时设置了时区为中国。
摘要由CSDN通过智能技术生成
  1. <?php

  2. header ( "Content-type: text/html; charset=utf-8" );

  3. date_default_timezone_set ( 'PRC' ); //设置中国时区

  4.  
  5. include 'PHPExcel.php';

  6. $dir=dirname(__FILE__);

  7.  
  8. $filename = "/Users/jiangminghui/Documents/test/hantai/hantaipic.xlsx";

  9.  
  10. $objPHPExcel = PHPExcel_IOFactory::load($filename);//加载文件

  11.  
  12. $sheet = $objPHPExcel->getSheet(0);

  13. $highestRow = $sheet->getHighestRow(); // 取得总行数

  14. $highestColumn = $sheet->getHighestColumn(); // 取得总列数

  15. $src_path1 = '111.png';

  16. $src_path2 = '222.png';

  17. $src1 = imagecreatefromstring(file_get_contents($src_path1));

  18. $src2 = imagecreatefromstring(file_get_contents($src_path2));

  19. list($src_w1,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值