This commit is contained in:
@@ -68,6 +68,9 @@ func (rc *shopItemController) GetById(c *gin.Context) {
|
|||||||
ReplyOK(c, shopItem)
|
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) {
|
func (rc *shopItemController) NewShopItemFromForm(ctx *gin.Context) (models.ShopItem, error) {
|
||||||
defaultImagePath := "static/img/zine.jpg"
|
defaultImagePath := "static/img/zine.jpg"
|
||||||
name := ctx.PostForm("name")
|
name := ctx.PostForm("name")
|
||||||
@@ -106,6 +109,14 @@ func (rc *shopItemController) NewShopItemFromForm(ctx *gin.Context) (models.Shop
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error during pdftoppm: ", err.Error())
|
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 {
|
} else {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
@@ -365,6 +376,13 @@ func (rc *shopItemController) AddItemsHandler(c *gin.Context) {
|
|||||||
fmt.Println("Error during pdftoppm: ", err.Error())
|
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")
|
category, err := models.ParseCategory("Zine")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorHandler(err)
|
errorHandler(err)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
go
|
go
|
||||||
gotools
|
gotools
|
||||||
poppler_utils #get first pdf page to png
|
poppler_utils #get first pdf page to png
|
||||||
|
imagemagick
|
||||||
tailwindcss
|
tailwindcss
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -71,6 +72,7 @@
|
|||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
zineshop-pkg
|
zineshop-pkg
|
||||||
pkgs.poppler_utils #get first pdf page to png
|
pkgs.poppler_utils #get first pdf page to png
|
||||||
|
pkgs.imagemagick
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
@@ -100,7 +102,7 @@
|
|||||||
WorkingDirectory = "/var/lib/zineshop";
|
WorkingDirectory = "/var/lib/zineshop";
|
||||||
ExecStart = pkgs.writeScript "start-zineshop" ''
|
ExecStart = pkgs.writeScript "start-zineshop" ''
|
||||||
#! ${pkgs.bash}/bin/bash
|
#! ${pkgs.bash}/bin/bash
|
||||||
PATH="$PATH:${lib.makeBinPath [ pkgs.poppler_utils ]}"
|
PATH="$PATH:${lib.makeBinPath [ pkgs.poppler_utils pkgs.imagemagick ]}"
|
||||||
${zineshop-pkg}/bin/zineshop
|
${zineshop-pkg}/bin/zineshop
|
||||||
'';
|
'';
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|||||||
Reference in New Issue
Block a user