Documentation ¶
Overview ¶
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var File = router.Handler(func(c router.Context) { filename := c.Param("filename") filePath := path.Join(config2.Upload.Path, config2.Upload.File.Path, filename) if isExistFile := fs.PathExists(filePath); isExistFile == false { http.NotFound(c.Writer(), c.Request()) return } c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%v", filename)) http.ServeFile(c.Writer(), c.Request(), filePath) })
View Source
var Image = router.Handler(func(c router.Context) { filename := c.Param("filename") originImagePath := path.Join(config2.Upload.Path, config2.Upload.Image.Path, filename) if fs.PathExists(originImagePath) == false { http.NotFound(c.Writer(), c.Request()) return } c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%v", filename)) http.ServeFile(c.Writer(), c.Request(), originImagePath) })
View Source
var Thumbnail = router.Handler(func(c router.Context) { filename := c.Param("filename") Config := config2.Upload originImagePath := path.Join(Config.Path, Config.Image.Path, filename) thumbnailImagePath := path.Join(Config.Path, Config.Image.Thumbnail.Path, filename) if fs.PathExists(thumbnailImagePath) == false { if fs.PathExists(originImagePath) == true { http.ServeFile(c.Writer(), c.Request(), originImagePath) return } http.NotFound(c.Writer(), c.Request()) return } c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%v", filename)) http.ServeFile(c.Writer(), c.Request(), thumbnailImagePath) })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.