This commit is contained in:
@@ -68,6 +68,9 @@ func (rc *shopItemController) GetById(c *gin.Context) {
|
||||
ReplyOK(c, shopItem)
|
||||
}
|
||||
|
||||
// this currently creates quite big preview images
|
||||
// workaround is running the following command in the uploads folder:
|
||||
// for file in *.png; do convert "$file" -resize 35% "$file"; done
|
||||
func (rc *shopItemController) NewShopItemFromForm(ctx *gin.Context) (models.ShopItem, error) {
|
||||
defaultImagePath := "static/img/zine.jpg"
|
||||
name := ctx.PostForm("name")
|
||||
@@ -106,6 +109,14 @@ func (rc *shopItemController) NewShopItemFromForm(ctx *gin.Context) (models.Shop
|
||||
if err != nil {
|
||||
fmt.Println("Error during pdftoppm: ", err.Error())
|
||||
}
|
||||
|
||||
cmd2 := exec.Command("convert", dstImage, "-resize", "35%", dstImage)
|
||||
_, err = cmd2.Output()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Error during resizing preview image: ", err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
fmt.Println(err)
|
||||
@@ -365,6 +376,13 @@ func (rc *shopItemController) AddItemsHandler(c *gin.Context) {
|
||||
fmt.Println("Error during pdftoppm: ", err.Error())
|
||||
}
|
||||
|
||||
cmd2 := exec.Command("convert", dstImage, "-resize", "35%", dstImage)
|
||||
_, err = cmd2.Output()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Error during resizing preview image: ", err.Error())
|
||||
}
|
||||
|
||||
category, err := models.ParseCategory("Zine")
|
||||
if err != nil {
|
||||
errorHandler(err)
|
||||
|
||||
Reference in New Issue
Block a user