手動上傳圖片文件

This commit is contained in:
2023-06-07 14:25:04 +08:00
parent 560151a72d
commit 324d6e0d50
6 changed files with 107 additions and 9 deletions

View File

@@ -18,9 +18,14 @@ import (
type Image struct {
ID int `json:"id" gorm:"primary_key"`
Name string `json:"name"`
Hash string `json:"hash"`
Path string `json:"path"`
Type string `json:"type"`
Size int `json:"size"`
Width int `json:"width"`
Height int `json:"height"`
Prompt string `json:"prompt"`
Format string `json:"format"`
NegativePrompt string `json:"negative_prompt"`
NumInferenceSteps int `json:"num_inference_steps"` // Number of inference steps (minimum: 1; maximum: 500)
GuidanceScale float32 `json:"guidance_scale"` // Scale for classifier-free guidance (minimum: 1; maximum: 20)
@@ -44,7 +49,6 @@ func (img *Image) ToWebP(width int, height int, fit string) ([]byte, error) {
if err != nil {
return nil, err
}
// 如果原图是GIF格式的动态图片直接不作尺寸处理直接转换为webp格式
if format == "gif" {
converter := giftowebp.NewConverter()