常用的php图片处理类(水印、等比缩放、固定高宽)分享
//PHP 添加水印 & 比例缩略图 & 固定高度 & 固定宽度 类。
class Image_process{
public $source; //原图
public $source_width; //原图宽度
public $source_height; //原图高度
public $source_type_id;
public $orign_name;
public $orign_dirname;
//传入原图路径
public function __construct($source){
$this->typeList = array(1=>'gif',2=>'jpg',3=>'png');
$ginfo = getimagesize($source);
$this->source_width = $ginfo[0];
$this->source_height = $ginfo[1];
$this->source_type_id = $ginfo[2];
$this->orign_url = $source;
$this->orign_name = basename($source);
$this->orign_dirname = dirname($source);
}
//判断图片的文件的格式,返回PHP可识别的编码
public function judgeType($type,$source){<