這篇文章主要介紹如何在Laravel上使用萬象優圖,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
執行 composer 命令安裝拓展
composer require yuecode/image
在config/app.php中的 Provider 中添加
\Yuecode\Image\ImageProvider::class,
執行 php artisan vendor:publish,將自動在 config/ 目錄下生成 image.php 文件,修改配置文件中的對應選項。
配置完成后,在需要使用的文件中使用
use Yuecode\Image\YouTu;
然后使用靜態方法調用
比如
$res = YouTu::pornDetectUrl( array( "https://cache.yisu.com/upload/information/20210522/355/681909.jpg", "https://cache.yisu.com/upload/information/20210522/355/681910.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)以上是“如何在Laravel上使用萬象優圖”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。