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字型,給圖片加浮水印時就可以自定圖片哦...