您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php给图片加文字水印与图片水印代码(1/3)_PHP教程

2025/9/12 11:37:56发布25次查看
php给图片加文字水印与图片水印代码这款程序给图片加文字水印时是调用 了c:\\windows\\fonts\\simhei.ttf字体,给图片加水印时就可以自定图片哦。
php教程给图片加文字水印与图片水印代码
这款程序给图片加文字水印时是调用 了c:windowsfontssimhei.ttf字体,给图片加水印时就可以自定图片哦。
$image->wprint_img();//执行图片水印
$image->wprint_string();//执行文字水印
*/
class editimage{
 private $imagefile;//图片文件
 private $smallimg;//水印图片
 private $string;//水印文字
 private $position;//存放位置
 private $dst_x=600;//原始图片打水印x坐标
 private $dst_y=0;//原始图片打水印y坐标
 private $str_x=450;
 private $str_y=200;
 private $font=c:windowsfontssimhei.ttf;//原始图片打水印字体路径
 private $imgej;// imagecolorallocate后的变量
function __get($value){
  return $this->$value;
 }
 function __set($property,$value){
  $this->$property=$value;
 }
 /**
  * 构造函数初始化
  *
  * @param string $imagefile 被上水印的文件
  * @param string $smallimg 水印文件
  * @param string $string 水印文字
  * @param string $position 存放位置
  * @param int $dst_x  被上水印的图片x
  * @param int $dst_y  被上水印的图片y
  */
 function __construct($imagefile,$smallimg='',$string=''){//,$position='',$dst_x=0,$dst_y=0
  $this->imagefile=$imagefile;
  $this->smallimg=$smallimg;
  $this->string=$string;
  $this->imgej=$this->imagecreatef($this->imagefile);
 }
 function get_extname($file){//获取文件的后缀名
  if (file_exists($this->imagefile)) {
   $img=getimagesize($file);
   switch ($img[2]){
    case 1:
     return gif;
    case 2:
     return jpg;
    case 3:
     return png;
   }
  }else{
   return false;
  }
 }
1 2 3
http://www.bkjia.com/phpjc/633042.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/633042.htmltecharticlephp给图片加文字水印与图片水印代码这款程序给图片加文字水印时是调用 了c:\\windows\\fonts\\simhei.ttf字体,给图片加水印时就可以自定图片哦...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product