edit-order-opt
This commit is contained in:
@@ -62,6 +62,46 @@ class Sign_entity{
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并图片
|
||||
* @param $origin_url string 原始图片
|
||||
* @param $user_file string 需要合并图片
|
||||
* @param $width int x坐标
|
||||
* @param $height int y坐标
|
||||
* @param string $s_path string 图片保存地址
|
||||
* @return bool|mixed string 返回合成后图片地址
|
||||
* @throws Exception
|
||||
*/
|
||||
public function merge_img($origin_url,$user_file,$width,$height,$s_path='' ){
|
||||
$arrContextOptions=array(
|
||||
"ssl"=>array(
|
||||
"verify_peer"=>false,
|
||||
"verify_peer_name"=>false,
|
||||
),
|
||||
);
|
||||
//临时保存签名图片
|
||||
if (!file_exists(FCPATH.'/temp')){
|
||||
$oldumask = umask(0);
|
||||
mkdir(FCPATH.'/temp', 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
$file_name = time().rand(1,9999999);
|
||||
!$s_path && $s_path = FCPATH.'temp/'.md5('sign'.$file_name).'.jpg';
|
||||
|
||||
$yhdata = file_get_contents($user_file,false,stream_context_create($arrContextOptions));
|
||||
$yh_image = Image::fromData($yhdata)->cropResize(200,200)->rotate(90);
|
||||
|
||||
|
||||
//原始签名文件
|
||||
$data = file_get_contents($origin_url,false,stream_context_create($arrContextOptions));
|
||||
$imgobj = Image::fromData($data);
|
||||
$imgobj->merge($yh_image,$width,$height)->save($s_path);
|
||||
if(file_exists($s_path)){
|
||||
return str_replace(FCPATH,'',$s_path);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user