101infotech/imgbb
Composer 安装命令:
composer require 101infotech/imgbb
包简介
Simple Way to upload image using imgbb api without any fuss.
README 文档
README
A simple package to upload your images to the ImgBB server without any fuss.This package will save your server bandwidth . Where 'ImgBB' is a Free image hosting and sharing service, upload pictures, photo host that Offers integration solutions for uploading images to forums.
Installation
You can install the ImgBB via composer:
composer require 101infotech/imgbb
Then publish the config file using:
php artisan vendor:publish --tag="ImgBB"
Uploading images
Use the following methods to upload your image to ImgBB:
- Get API key from ImgBB
- Put your API key in the '.env' file with 'IMGBB_API_KEY' variable
- You are good to go!
Upload image
To upload an image to ImgBB, use the following command:
ImgBB::image($request->file('image'), 'image_name', expiration_in_seconds);
Datatypes Object $image, String image_name, Int expiration_in_seconds.
Remember 'image_name' and 'expiration_in_seconds' are optional.
Upload Image URL
To upload an image from URL, use the following command:
ImgBB::url('https://i.ibb.co/SdHW3ch/chart-1641904891.png', 'image_name', expiration_in_seconds);
Datatypes String image_url, String image_name, Int expiration_in_seconds.
Remember 'image_name' and 'expiration_in_seconds' are optional.
Response
After a successful upload, ImgBB returns a JSON response with the following fields:
{
"data": {
"id": "2ndCYJK",
"title": "c1f64245afb2",
"url_viewer": "https://ibb.co/2ndCYJK",
"url": "https://i.ibb.co/w04Prt6/c1f64245afb2.gif",
"display_url": "https://i.ibb.co/98W13PY/c1f64245afb2.gif",
"size": "42",
"time": "1552042565",
"expiration": "0",
"image": {
"filename": "c1f64245afb2.gif",
"name": "c1f64245afb2",
"mime": "image/gif",
"extension": "gif",
"url": "https://i.ibb.co/w04Prt6/c1f64245afb2.gif"
},
"thumb": {
"filename": "c1f64245afb2.gif",
"name": "c1f64245afb2",
"mime": "image/gif",
"extension": "gif",
"url": "https://i.ibb.co/2ndCYJK/c1f64245afb2.gif"
},
"medium": {
"filename": "c1f64245afb2.gif",
"name": "c1f64245afb2",
"mime": "image/gif",
"extension": "gif",
"url": "https://i.ibb.co/98W13PY/c1f64245afb2.gif"
},
"delete_url": "https://ibb.co/2ndCYJK/670a7e48ddcb85ac340c717a41047e5c"
},
"success": true,
"status": 200
}
Change Log
v1.0.0: Initial release.
v1.0.1: Added image 'name' and 'expiration'.
v1.1.0: Added publishable config file.
101infotech/imgbb 适用场景与选型建议
101infotech/imgbb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 224 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 101infotech/imgbb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 101infotech/imgbb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 224
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-11