码迷,mamicode.com
首页 > Web开发 > 详细

PHP之水印

时间:2016-12-15 18:07:40      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:ges   esx   制作   拷贝   nbsp   jpg   ima   rom   output   

 1 <?php
 2 
 3     //水印制作
 4     $create_func_list = array(
 5 
 6         image/jpeg => imagecreatefromjpeg,
 7         image/png  => imagecreatefrompng
 8     );
 9 
10     $output_func_list =array(
11 
12         image/jpeg => image/jpeg
13 
14     );
15 
16     //待加水印的图片
17     $dst_file = psb.jpg;
18     $stamp_file = stamp.jpg;
19 
20     $dst_info = getimagesize($dst_file);
21     $dst_mime = $dst_info[mime];
22 
23     $dst_create_func = $create_func_list[$dst_mime];
24     $dst_image = $dst_create_func($dst_file);
25 
26     $stamp_image = imagecreatefromjpeg($stamp_file);
27     $stamp_w = imagesx($stamp_image);
28     $stamp_h = imagesy($stamp_image);
29 
30     //印章位置
31     $dst_x = 200;
32     $dst_y = 80;
33 
34     //印章采样位置
35     $stamp_area_x = 0;
36     $stamp_area_y = 0;
37     $stamp_area_w = $stamp_w;
38     $stamp_area_h = $stamp_h;
39 
40     $pct = 25;
41     //采样 拷贝 合并
42     imagecopymerge($dst_image, $stamp_image, $dst_x, $dst_y, $stamp_area_x,$stamp_area_y , $stamp_area_w,$stamp_area_h , $pct); 
43 
44     header("content-type:image/jpeg");
45     imagejpeg($dst_image);
46     imagedestroy($dst_image);
47     imagedestroy($stamp_image);

 

PHP之水印

标签:ges   esx   制作   拷贝   nbsp   jpg   ima   rom   output   

原文地址:http://www.cnblogs.com/sharecorner/p/6183798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!