Documentation ¶
Index ¶
- Variables
- func ToolFixThumbnail() (err error)
- func ToolThumbnail(f multipart.File, p2 string) (err error)
- type ErrorResp
- type Picture
- func (pic *Picture) GenDelToken() (err error)
- func (pic *Picture) GenSavToken() (err error)
- func (pic *Picture) Init() (err error)
- func (pic *Picture) IsValid() (err error)
- func (pic *Picture) Save() (err error)
- func (pic *Picture) SaveFileAndThumbnail(f multipart.File) (err error)
- func (p *Picture) ToJson() (s string)
- func (pic *Picture) Update() (err error)
- type UploadHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StoreDir string // 储存目录 StoreDirThumbnail string // 缩略图储存目录 ResizeThumbnailWidth uint // 缩略图宽度 ResizeThumbnailHeight uint // 缩略图高度 SourceMaxWidth uint = 2560 // 图片素材最大宽度 SourceMaxHeight uint = 2560 // 图片素材最大高度 )
储存目录
View Source
var (
AllowCors = true
)
View Source
var (
ErrCategory error = errors.New("Upload category is not valid")
)
Functions ¶
Types ¶
type Picture ¶
type Picture struct { OriginName string `json:",omitempty"` // 原文件名 OriginWidth int `json:",omitempty"` // 原文件宽度 OriginHeight int `json:",omitempty"` // 原文件高度 Size int64 `json:",omitempty"` // 文件大小 ContentType string `json:",omitempty"` // 文件类型 StoreToken orm.Accession `json:",omitempty"` // 储存key todo: 即ID DeleteToken orm.Uid `json:",omitempty"` // 删除key FetchToken string `json:",omitempty"` // 访问key FetchThumbnailToken string `json:",omitempty"` // 访问缩略图key Sha1 string `json:",omitempty"` // 文件哈希 Sha1Thumbnail string `json:",omitempty"` // 缩略图哈希 CreatTime time.Time `json:",omitempty"` // 上传时间 DownloadTimes int `json:",omitempty"` // 下载次数 Category string `json:",omitempty"` // 图片类型 // contains filtered or unexported fields }
func (*Picture) SaveFileAndThumbnail ¶
保存图片及缩略图
type UploadHandler ¶
type UploadHandler struct { filepool.UploadFileRequire Category string }
func (*UploadHandler) ServeHTTP ¶
func (h *UploadHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.