mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
feat(thumb): use libvips to generate thumb
This commit is contained in:
@@ -137,20 +137,20 @@ func (fs *FileSystem) GenerateThumbnail(ctx context.Context, file *model.File) e
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
thumbPath, err := thumb.Generators.Generate(source, file.Name, model.GetSettingByNames(
|
||||
thumbPath, err := thumb.Generators.Generate(ctx, source, file.Name, model.GetSettingByNames(
|
||||
"thumb_width",
|
||||
"thumb_height",
|
||||
"thumb_builtin_enabled",
|
||||
"thumb_vips_enabled",
|
||||
"thumb_ffmpeg_enabled",
|
||||
"thumb_vips_path",
|
||||
"thumb_ffmpeg_path",
|
||||
))
|
||||
if err != nil {
|
||||
_ = updateThumbStatus(file, model.ThumbStatusNotAvailable)
|
||||
return fmt.Errorf("failed to generate thumb for %q: %w", file.Name, err)
|
||||
}
|
||||
|
||||
defer os.Remove(thumbPath)
|
||||
|
||||
thumbFile, err := os.Open(thumbPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open temp thumb %q: %w", thumbFile, err)
|
||||
|
||||
Reference in New Issue
Block a user