版權聲明:本文由白宦成原創文章,轉載請註明出處:
文章原文連接:https://www.qcloud.com/community/article/574549001488234358php
來源:騰雲閣 https://www.qcloud.com/communitylaravel
萬象優圖是騰訊云爲開發者提供圖片智能鑑黃、圖片內容識別、人臉識別、OCR識別等服務;也能夠根據需求提供定製化的圖片識別服務;同時也提供靈活的圖像編輯服務,如裁剪、壓縮,水印等,知足您的各類業務場景圖片需求。app
執行 composer
命令安裝拓展composer
composer require yuecode/image
在config/app.php
中的 Provider 中添加ide
\Yuecode\Image\ImageProvider::class,
執行 php artisan vendor:publish
,將自動在 config/
目錄下生成 image.php
文件,修改配置文件中的對應選項。ui
配置完成後,在須要使用的文件中使用spa
use Yuecode\Image\YouTu;
而後使用靜態方法調用
好比code
$res = YouTu::pornDetectUrl(
array( "http://www.bz55.com/uploads/allimg/140805/1-140P5162300-50.jpg", "http://img.taopic.com/uploads/allimg/130716/318769-130G60P30462.jpg" ) ); dd($res);
方法名 | 備註 |
---|---|
uploadImage | 上傳圖片,萬象優圖V2接口 |
statImage | 查詢圖片信息,萬象優圖V2接口 |
copyImage | 複製圖片,萬象優圖V2接口 |
delImage | 刪除圖片,萬象優圖V2接口 |
uploadImageV1 | 上傳圖片,萬象優圖V1接口 |
statImageV1 | 查詢圖片信息,萬象優圖V1接口 |
copyImageV1 | 複製圖片,萬象優圖V1接口 |
delImageV1 | 刪除圖片,萬象優圖V1接口 |
uploadVideo | 上傳視頻 |
statVideo | 查看視頻狀態 |
delVideo | 刪除視頻文件 |
pornDetect | 智能鑑黃,參數爲URL |
pornDetectUrl | 多圖片智能鑑黃,參數爲URL構成的array |
pornDetectFile | 圖片文件只能鑑黃,參數爲文件的array |
上傳圖片視頻
$res = YouTu::uploadImage($request->file('x')->getRealPath()); dd($res)
智能鑑黃接口
$res = YouTu::pornDetect('http://img.taopic.com/uploads/allimg/130716/318769-130G60P30462.jpg') dd($res)