mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-06-02 14:10:25 +08:00
feat(upload): add image format conversion and quality settings for uploads #6
This commit is contained in:
@@ -238,8 +238,7 @@ public sealed class BackgroundTaskQueue : IBackgroundTaskQueue, IDisposable
|
||||
await UpdatePictureStatus(task.PictureId, ProcessingStatus.Processing, 20);
|
||||
var thumbnailPath = Path.Combine(
|
||||
Path.GetDirectoryName(localFilePath)!,
|
||||
Path.GetFileNameWithoutExtension(Path.GetFileName(localFilePath)) + "_thumb" +
|
||||
Path.GetExtension(localFilePath));
|
||||
Path.GetFileNameWithoutExtension(Path.GetFileName(localFilePath)) + "_thumb.webp");
|
||||
|
||||
await ImageHelper.CreateThumbnailAsync(localFilePath, thumbnailPath, 500);
|
||||
|
||||
@@ -257,7 +256,7 @@ public sealed class BackgroundTaskQueue : IBackgroundTaskQueue, IDisposable
|
||||
// 非本地存储,上传缩略图到对应的存储服务
|
||||
await using var thumbnailFileStream = new FileStream(thumbnailPath, FileMode.Open, FileAccess.Read);
|
||||
var thumbnailFileName = Path.GetFileName(thumbnailPath);
|
||||
var thumbnailContentType = Path.GetExtension(thumbnailPath).ToLower() == ".png" ? "image/png" : "image/jpeg";
|
||||
var thumbnailContentType = "image/webp";
|
||||
|
||||
// 上传缩略图并获取存储路径或元数据
|
||||
string thumbnailStoragePath = await storageService.SaveAsync(
|
||||
|
||||
Reference in New Issue
Block a user