/**
* @Apidoc\Title("上传图片")
* @Apidoc\Desc("上传图片")
* @Apidoc\Url("/index/uploadpic")
* @Apidoc\Method("get")
* @Apidoc\Tag("")
* @Apidoc\Header("")
* @Apidoc\Param("filename", type="string",require=true, desc="上传图片的file名称" )
* @Apidoc\Returned("", type="", desc="图片路径")
*/
public function uploadpic()
{
$pic_path = $this->one_upload('filename');
return $pic_path;
}
/**
* @Apidoc\Title("图片检测")
* @Apidoc\Desc("图片检测")
* @Apidoc\Url("/index/imagecheck")
* @Apidoc\Method("get")
* @Apidoc\Tag("")
* @Apidoc\Header("")
* @Apidoc\Param("picpath", type="string",require=true, desc="uploadpic返回的图片路径" )
* @Apidoc\Returned("", type="", desc="")
*/
public function imagecheck()
{
$picpath=input('picpath','');
if(empty($picpath)){ $this->BackResult(1, '请传入图片'); }
$access_token=weixin_access_token_check();
//图片检测
$result=$this->imagecheckcall($access_token,$picpath);
// echo '
';
// print_r($result);
$this->BackResult(0, '数据结果',$result);
}
//图片检测
public function imagecheckcall($access_token='',$img_path)
{
$img_path='./'.$img_path;
$url='https://api.weixin.qq.com/wxa/img_sec_check?access_token='.$access_token;
if (class_exists('\CURLFile')) {
$josn = array('media' => new \CURLFile(realpath($img_path)));
} else {
$josn = array('media' => '@' . realpath($img_path));
}
$result=curl_call($url,'post',$josn);
$result=json_decode($result,true);
//print_r($result);
return $result;
}