@@ -84,7 +84,7 @@ func SaveAll(ctx context.Context, artwork *types.Artwork, picture *types.Picture
84
84
common .Logger .Fatalf ("Unknown storage type: %s" , config .Cfg .Storage .RegularType )
85
85
return nil , fmt .Errorf ("%w: %s" , errs .ErrStorageUnkown , config .Cfg .Storage .RegularType )
86
86
}
87
- regularOutputPath := filePath [:len (filePath )- len (filepath .Ext (filePath ))] + "_regular.webp"
87
+ regularOutputPath := fmt . Sprintf ( "%s_regular.%s" , filePath [:len (filePath )- len (filepath .Ext (filePath ))], config . Cfg . Storage . RegularFormat )
88
88
if err := common .CompressImageByFFmpeg (filePath , regularOutputPath , types .RegularPhotoSideLength ); err != nil {
89
89
return nil , err
90
90
}
@@ -95,7 +95,7 @@ func SaveAll(ctx context.Context, artwork *types.Artwork, picture *types.Picture
95
95
if picture .ID == "" {
96
96
picture .ID = primitive .NewObjectID ().Hex ()
97
97
}
98
- regularStorageFileName := picture .ID + "_regular.webp"
98
+ regularStorageFileName := picture .ID + "_regular." + config . Cfg . Storage . RegularFormat
99
99
regularStoragePath := fmt .Sprintf ("/regular/%s/%s/%s" , artwork .SourceType , artwork .Artist .UID , regularStorageFileName )
100
100
101
101
regularDetail , err = regularStorage .Save (ctx , regularOutputPath , regularStoragePath )
@@ -110,7 +110,8 @@ func SaveAll(ctx context.Context, artwork *types.Artwork, picture *types.Picture
110
110
common .Logger .Fatalf ("Unknown storage type: %s" , config .Cfg .Storage .ThumbType )
111
111
return nil , fmt .Errorf ("%w: %s" , errs .ErrStorageUnkown , config .Cfg .Storage .ThumbType )
112
112
}
113
- thumbOutputPath := filePath [:len (filePath )- len (filepath .Ext (filePath ))] + "_thumb.webp"
113
+ // thumbOutputPath := filePath[:len(filePath)-len(filepath.Ext(filePath))] + "_thumb.webp"
114
+ thumbOutputPath := fmt .Sprintf ("%s_thumb.webp" , filePath [:len (filePath )- len (filepath .Ext (filePath ))])
114
115
if err := common .CompressImageByFFmpeg (filePath , thumbOutputPath , types .ThumbPhotoSideLength ); err != nil {
115
116
return nil , err
116
117
}
@@ -122,7 +123,7 @@ func SaveAll(ctx context.Context, artwork *types.Artwork, picture *types.Picture
122
123
if picture .ID == "" {
123
124
picture .ID = primitive .NewObjectID ().Hex ()
124
125
}
125
- thumbStorageFileName := picture .ID + "_thumb.webp"
126
+ thumbStorageFileName := picture .ID + "_thumb." + config . Cfg . Storage . ThumbFormat
126
127
thumbStoragePath := fmt .Sprintf ("/thumb/%s/%s/%s" , artwork .SourceType , artwork .Artist .UID , thumbStorageFileName )
127
128
128
129
thumbDetail , err = thumbStorage .Save (ctx , thumbOutputPath , thumbStoragePath )
0 commit comments