ImgBB API
Upload images to ImgBB and get shareable URLs.
When This Skill Activates
This skill triggers when user wants to upload images to the web for sharing.
Reasoning Framework
| Step | Action | Why |
|---|
| 1 | CHECK | Verify API key is available |
| 2 |
PREPARE | Get image path or URL |
| 3 |
UPLOAD | Send to ImgBB API |
| 4 |
RETURN | Return shareable URL |
Setup
CODEBLOCK0
Get API Key
- 1. Go to https://api.imgbb.com/
- Click "Get API Key"
- Copy your API key
Decision Tree
CODEBLOCK1
Usage
CODEBLOCK2
Options
| Flag | Description |
|---|
| INLINECODE0 | Path to image |
| INLINECODE1 |
API key |
|
--url | Upload from URL |
|
--name | Custom name |
|
--expiration | Expiry seconds |
|
--json | JSON output |
|
--batch | Batch folder |
|
--set-key | Save API key |
Troubleshooting
No API key found
- - Fix: Set
IMGBB_API_KEY env or use INLINECODE9
File not found
- - Fix: Check file path is correct
Invalid image format
- - Fix: Use JPG, PNG, GIF, or WEBP
Image too large
- - Fix: Compress under 32MB
Quick Reference
| Task | Command |
|---|
| Upload | INLINECODE10 |
| URL |
python imgbb.py --url "URL" |
| Batch |
python imgbb.py --batch ./folder/ |
| JSON |
python imgbb.py image.jpg --json |
ImgBB API
将图片上传至ImgBB并获取可分享的链接。
技能触发条件
当用户希望将图片上传至网络进行分享时,此技能将被触发。
推理框架
准备 | 获取图片路径或URL |
| 3 |
上传 | 发送至ImgBB API |
| 4 |
返回 | 返回可分享的链接 |
设置
bash
export IMGBBAPIKEY=yourapikey_here
或
echo your
apikey > ~/.imgbb
apikey
获取API密钥
- 1. 访问 https://api.imgbb.com/
- 点击获取API密钥
- 复制您的API密钥
决策树
├── 上传单张图片 → python imgbb.py image.jpg
├── 从URL上传 → python imgbb.py --url URL
├── 自定义名称 → python imgbb.py image.jpg --name myimg
├── 设置过期时间 → python imgbb.py image.jpg --expiration 3600
├── 批量上传 → python imgbb.py --batch ./folder/
└── JSON输出 → python imgbb.py image.jpg --json
使用方法
bash
上传文件
python imgbb.py image.jpg
使用自定义API密钥
python imgbb.py image.jpg --key YOUR_KEY
从URL上传
python imgbb.py --url https://...
批量上传
python imgbb.py --batch ./folder/
JSON输出
python imgbb.py image.jpg --json
选项
API密钥 |
| --url | 从URL上传 |
| --name | 自定义名称 |
| --expiration | 过期秒数 |
| --json | JSON输出 |
| --batch | 批量文件夹 |
| --set-key | 保存API密钥 |
故障排除
未找到API密钥
- - 解决方法:设置IMGBBAPIKEY环境变量或使用--key
文件未找到
图片格式无效
- - 解决方法:使用JPG、PNG、GIF或WEBP格式
图片过大
快速参考
| 任务 | 命令 |
|---|
| 上传 | python imgbb.py image.jpg |
| URL |
python imgbb.py --url URL |
| 批量 | python imgbb.py --batch ./folder/ |
| JSON | python imgbb.py image.jpg --json |