From 87e34fc213fdf1616d23b1d6988d86af55b750eb Mon Sep 17 00:00:00 2001 From: Johnson Wang Date: Sat, 23 Jun 2018 11:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=BA=E8=84=B8=E8=9E=8D?= =?UTF-8?q?=E5=90=88=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TencentYoutuyun/Youtu.php | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/TencentYoutuyun/Youtu.php b/TencentYoutuyun/Youtu.php index c61bfc9..c50b0a2 100644 --- a/TencentYoutuyun/Youtu.php +++ b/TencentYoutuyun/Youtu.php @@ -2417,6 +2417,53 @@ public static function plateocrurl($url, $seq='') { $rsp = Http::send($req); $ret = json_decode($rsp, true); + if(!$ret){ + return self::getStatusText(); + } + return $ret; + } + + /** + * fusionface 人脸融合 + * @param $url 待融合的图片url + * @param $model_id 融合模板图片 + * @return 返回的结果,JSON字符串,字段参见API文档 + */ + public static function fusionface($url, $model_id, $seq='') { + + $expired = time() + self::EXPIRED_SECONDS; + $postUrl = Conf::$END_POINT . 'cgi-bin/pitu_open_access_for_youtu.fcg'; + $sign = Auth::appSign($expired, Conf::$USER_ID); + + $post_data = array( + 'app_id' => Conf::$APPID, + 'rsp_img_type' => 'url', + 'img_data' => base64_encode(file_get_contents($url)), + 'opdata' => array( + array( + 'cmd' => 'doFaceMerge', + 'params' => array( + 'model_id' => $model_id, + ), + ), + ), + ); + + $req = array( + 'url' => $postUrl, + 'method' => 'post', + 'timeout' => 10, + 'data' => json_encode($post_data), + 'header' => array( + 'Authorization:'.$sign, + 'Content-Type:text/json', + 'Expect: ', + ), + ); + + $rsp = Http::send($req); + $ret = json_decode($rsp, true); + if(!$ret){ return self::getStatusText(); }