เพิ่ม S3 Channel
เหมาะกับกรณีไหน
ใช้ S3 channel เมื่อ:
- ต้องการเชื่อมต่อ object storage service ที่รองรับ S3 เช่น Cloudflare R2, Backblaze B2, MinIO, AWS S3 หรือ provider อื่นที่ compatible
- ชอบรูปแบบการตั้งค่า S3 มาตรฐาน:
Endpoint, Access Key และ Secret Key - ไม่ต้องการใช้ native Cloudflare R2 binding channel หรือ storage provider ของคุณไม่ใช่ Cloudflare R2
สิ่งที่ต้องเตรียมก่อนเริ่ม
| Requirement | Purpose |
|---|---|
| S3 Endpoint | S3 API endpoint ของ object storage service |
| Bucket name | Bucket ที่จะใช้เก็บ files |
| Region | Storage region สำหรับ Cloudflare R2 มักเป็น auto |
| Access Key ID | S3 access key ID |
| Secret Access Key | S3 secret access key |
| CDN domain | Custom domain สำหรับ file access แบบ optional |
ตัวอย่าง Cloudflare R2 ผ่าน S3 API:
text
Endpoint: https://your-account-id.r2.cloudflarestorage.com
Bucket: your-r2-bucket-name
Region: auto
Access Key ID: copied from the Cloudflare R2 API token
Secret Access Key: copied from the Cloudflare R2 API tokenเพิ่มได้จากที่ไหน
- เปิด System Settings
- ไปที่ Upload Settings
- คลิก Add Channel ที่มุมขวาบน
- เลือก
S3
Field Reference
| Field | ใช้ทำอะไร | Required |
|---|---|---|
| Channel name | ชื่อที่จำง่ายสำหรับ S3 channel เช่น s3test หรือ R2-S3 | Yes |
| Enable channel | ควบคุมว่า channel นี้จะเข้าร่วม upload selection หรือไม่ | Recommended |
| Endpoint | Full S3 service endpoint รวม https:// | Yes |
| Custom CDN domain | Optional เมื่อใส่แล้ว generated file links จะ prefer domain นี้ | No |
| Bucket name | Bucket name เช่น s3test หรือ img-r2 | Yes |
| Bucket region | Region สำหรับ Cloudflare R2 มักเป็น auto | Yes |
| Access Key ID | S3 access key ID | Yes |
| Secret Access Key | S3 secret access key | Yes |
| Path-style access | Compatibility switch ค่าเริ่มต้น off บาง MinIO, OpenList หรือ self-hosted S3 service อาจต้องใช้ | No |
| Quota limit | ควบคุมว่า S3 channel นี้เข้าร่วม upload selection ตาม capacity หรือไม่ | No |
| Capacity limit | Required หลังเปิด quota limit เช่น 10 GB | Required เมื่อเปิด quota limit |
| Threshold | หยุดเขียนเมื่อ usage ถึง percentage นี้ เช่น 90% | Required เมื่อเปิด quota limit |
| Remark | หมายเหตุสำหรับดูแลเอง | No |
สร้าง Cloudflare R2 S3 API Keys
- เปิด Cloudflare Dashboard
- ไปที่
R2 Object Storage - หา
Manage R2 API Tokensหรือ entry สำหรับจัดการ API token

- สร้าง R2 API token ที่ access target bucket ได้

- Copy
Access Key IDและSecret Access Keyที่สร้างขึ้น

- กลับไปหน้า R2 bucket และ confirm bucket name
- จด S3 API endpoint ของ account โดยปกติหน้าตาแบบนี้:
text
https://your-account-id.r2.cloudflarestorage.comขั้นตอนตั้งค่า
- เปิด Upload Settings
- คลิก Add Channel
- เลือก
S3 - ใส่ channel name ที่จำได้ เช่น
s3test - ใส่ S3 API endpoint ใน
Endpoint - ถ้าใช้ custom CDN ให้ใส่ใน
Custom CDN domain; ถ้าไม่ใช้ให้เว้นว่าง - ใส่ bucket name
- ใส่ region สำหรับตัวอย่าง Cloudflare R2 ใช้
auto - ใส่ Access Key ID และ Secret Access Key
- ปล่อย path-style access เป็น off เว้นแต่ provider ระบุชัดว่าต้องใช้
- ถ้าต้องการ capacity control ให้เปิด quota limit แล้วใส่ capacity limit และ threshold
- คลิก Save

วิธีตรวจสอบ
| Check | วิธีตรวจสอบ |
|---|---|
| เห็น channel card | หลัง save หน้า Upload Settings ควรแสดง S3 channel card |
| Channel enabled | Switch มุมขวาบนของ card ควรอยู่ on |
| Key fields ถูกบันทึก | Detail view ควรแสดง Endpoint, Bucket, Region, path-style access และ fields ที่เกี่ยวข้อง |
| Upload ใช้งานได้ | Upload test image แล้วตรวจว่า object ไปอยู่ใน target bucket |
| Link เปิดได้ | Image link ที่ได้หลัง upload ควรเปิดได้ปกติ |
| Capacity display ใช้งานได้ | ถ้าเปิด quota limit card ควรแสดง used capacity และ configured limit |
S3 capacity statistics คำนวณจาก local file records ของ ImgBed ไม่ได้ query provider bucket แบบ real time หลัง save S3 configuration แล้ว system จะ recalculate quota ledger จาก current D1 records

FAQ
ควรเปิด path-style access ไหม?
โดยทั่วไปไม่ต้อง
เปิดเฉพาะเมื่อ S3-compatible provider ไม่รองรับ virtual-hosted-style URLs หรือ provider documentation ระบุชัดว่าต้องใช้ path-style access บาง MinIO, self-hosted S3 และ OpenList-compatible endpoints อาจต้องใช้
CDN domain ใช้ทำอะไร?
ถ้าคุณวาง CDN หรือ custom access domain ไว้หน้า bucket ให้ใส่ตรงนี้
หลัง configure แล้ว generated file links จะ prefer domain นี้ ถ้าไม่ได้ใช้ CDN ให้เว้นว่าง
Upload fail เพราะอะไร?
ตรวจสิ่งเหล่านี้ก่อน:
- Endpoint เป็น full
https://URL - Bucket name ถูกต้อง
- Region ตรงกับ requirement ของ provider
- Copy Access Key ID และ Secret Access Key มาครบ
- Key มี write permission สำหรับ target bucket
- Provider ไม่ต้องใช้ path-style access หรือถ้าต้องใช้ก็เปิดไว้แล้ว
Quick Checklist
text
เตรียม S3 Endpoint, Bucket, Region, Access Key และ Secret Key
-> เปิด Upload Settings
-> Add Channel
-> เลือก S3
-> ใส่ Endpoint / Bucket / Region / Access Key / Secret Key
-> ใส่ CDN domain หากจำเป็น
-> ปล่อย path-style access off เป็นค่าเริ่มต้น
-> เปิด quota limit หากจำเป็น
-> Save
-> Upload test image แล้วตรวจผล