Browse Source

thumbs.sh

pull/1/head
Georg Spar 1 year ago
parent
commit
32a24031a5
  1. 8
      thumbs.sh
  2. 6
      wdm.go

8
thumbs.sh

@ -0,0 +1,8 @@
#!/bin/bash
cd /opt/data/uploads
for i in *.png; do convert -thumbnail 80 $i thumb-$i; done;
for i in *.jpg; do convert -thumbnail 80 $i thumb-$i; done;
for i in *.jpeg; do convert -thumbnail 80 $i thumb-$i; done;
for i in *.webp; do convert -thumbnail 80 $i thumb-$i; done;
cd /

6
wdm.go

@ -6,6 +6,7 @@ import (
"io"
"net/http"
"os"
"os/exec"
"strconv"
"github.com/gorilla/mux"
@ -774,6 +775,11 @@ func uploadFileHandler(writer http.ResponseWriter, req *http.Request) {
writer.Header().Set("Content-Type", "application/json")
writer.WriteHeader(http.StatusCreated)
writer.Write(b)
cmd := exec.Command("./thumbs.sh")
if err := cmd.Run(); err != nil {
log.Fatal("Error while creating thumbs: ", err)
}
log.Info("Thumbs created after photo creation")
}
}

Loading…
Cancel
Save