Frontend: Refactor photo model to use primary file as preview #212 #217

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer
2020-01-24 01:33:04 +01:00
parent 2f48dae860
commit d3330877d1
5 changed files with 49 additions and 23 deletions

View File

@@ -1,5 +1,11 @@
package api
import (
"net/http"
"github.com/gin-gonic/gin"
)
var photoIconSvg = []byte(`
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
@@ -12,3 +18,18 @@ var albumIconSvg = []byte(`<svg xmlns="http://www.w3.org/2000/svg" width="24" he
var labelIconSvg = []byte(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/><path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"/></svg>`)
// GET /api/v1/svg/*
func GetSvg(router *gin.RouterGroup) {
router.GET("/svg/photo", func(c *gin.Context) {
c.Data(http.StatusOK, "image/svg+xml", photoIconSvg)
})
router.GET("/svg/label", func(c *gin.Context) {
c.Data(http.StatusOK, "image/svg+xml", labelIconSvg)
})
router.GET("/svg/album", func(c *gin.Context) {
c.Data(http.StatusOK, "image/svg+xml", albumIconSvg)
})
}