chipslays / imgfy-api
Imgfy.cf 的官方 API 包装器
1.0.1
2021-02-05 20:18 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2024-09-06 20:41:18 UTC
README
Imgfy - 是一个简单美观的图片上传服务。
安装
$ composer require chipslays/imgfy-api
方法
upload
将图片上传到 Imgfy.cf
Imgfy::upload(string|array $images [, bool $secretly = false]) : array
上传单个图片
use Chipslays\Imgfy\Imgfy; require __DIR__ . '/vendor/autoload.php'; $response = Imgfy::upload('potato.png'); print_r($response); Array ( [0] => Array ( [filename] => potato.png [preview] => https://imgfy.cf/hs7oe [source] => https://imgfy.cf/file/b49432863e12495ddf099.png ) )
上传多个图片
use Chipslays\Imgfy\Imgfy; require __DIR__ . '/vendor/autoload.php'; $response = Imgfy::upload([ 'potato.png', 'chips.jpg', ]); print_r($response); Array ( [0] => Array ( [filename] => potato.png [preview] => https://imgfy.cf/hs7oe [source] => https://imgfy.cf/file/b49432863e12495ddf099.png ) [1] => Array ( [filename] => chips.png [preview] => https://imgfy.cf/hs7od [source] => https://imgfy.cf/file/b39423123e15595dfd019.png ) )
生成超级秘密链接
use Chipslays\Imgfy\Imgfy; require __DIR__ . '/vendor/autoload.php'; $response = Imgfy::upload('potato.png', true); print_r($response); Array ( [0] => Array ( [filename] => potato.png [preview] => https://imgfy.cf/z:maewitZhZRKPD [source] => https://imgfy.cf/file/b32166863eaf495ddf079.png ) )
短别名 upload_imgfy
函数。
$response = upload_imgfy('potato.png'); $response = upload_imgfy(['potato.png', 'chips.jpg']); // super-secretly link $response = upload_imgfy('potato.png', true); $response = upload_imgfy(['potato.png', 'chips.jpg'], true);