feat: add image upload functionality for articles

- Implemented image upload API in the article service, allowing users to upload images associated with articles.
- Added validation for image size and type, ensuring only supported formats (PNG, JPG, GIF, WebP) are accepted.
- Created a new Aliyun object storage client to handle image storage and retrieval.
- Updated the article handler to include an endpoint for image uploads.
- Enhanced error handling for image upload failures and added relevant error messages.
- Introduced public URL generation for stored images, allowing access via signed tokens.
- Updated localization files to include new messages related to image upload functionality.
- Added tests for image upload and retrieval processes.
This commit is contained in:
2026-04-05 22:10:05 +08:00
parent 1401b50556
commit 94f7186cce
19 changed files with 1033 additions and 14 deletions
+17
View File
@@ -25,9 +25,26 @@ object_storage:
endpoint: localhost:9000
bucket: geo-private
use_ssl: false
public_base_url: ""
region: ""
# Prefer environment override for secrets:
# export OBJECT_STORAGE_ACCESS_KEY=minioadmin
# export OBJECT_STORAGE_SECRET_KEY=minioadmin
# MinIO example:
# provider: minio
# endpoint: localhost:9000
# bucket: geo-private
# use_ssl: false
#
# Aliyun OSS example:
# provider: aliyun
# endpoint: https://oss-cn-hangzhou.aliyuncs.com
# bucket: your-bucket
# region: cn-hangzhou
# use_ssl: true
# public_base_url: https://your-bucket.oss-cn-hangzhou.aliyuncs.com
# export OBJECT_STORAGE_ACCESS_KEY=your-access-key
# export OBJECT_STORAGE_SECRET_KEY=your-secret-key
jwt:
secret: "your-local-secret"