chore: auto-commit uncommitted changes
This commit is contained in:
parent
f8f7f69db8
commit
0e9f93f561
14
main.go
14
main.go
|
|
@ -134,12 +134,14 @@ func captureHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize to 50% using sips
|
// Resize to 50% unless full resolution requested
|
||||||
if out, err := exec.Command("sips", "-g", "pixelWidth", tmpFile).Output(); err == nil {
|
if r.URL.Query().Get("full") != "1" {
|
||||||
re := regexp.MustCompile(`pixelWidth:\s*(\d+)`)
|
if out, err := exec.Command("sips", "-g", "pixelWidth", tmpFile).Output(); err == nil {
|
||||||
if m := re.FindSubmatch(out); m != nil {
|
re := regexp.MustCompile(`pixelWidth:\s*(\d+)`)
|
||||||
if w, _ := strconv.Atoi(string(m[1])); w > 0 {
|
if m := re.FindSubmatch(out); m != nil {
|
||||||
exec.Command("sips", "--resampleWidth", strconv.Itoa(w/2), tmpFile).Run()
|
if w, _ := strconv.Atoi(string(m[1])); w > 0 {
|
||||||
|
exec.Command("sips", "--resampleWidth", strconv.Itoa(w/2), tmpFile).Run()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue