mirror of
https://github.com/tenox7/wrp.git
synced 2024-12-22 21:29:29 +00:00
log decode error instead of bailing out
This commit is contained in:
parent
a3eb7cb69a
commit
57a107aa69
15
wrp.go
15
wrp.go
@ -8,18 +8,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
_ "image"
|
||||
"image/gif"
|
||||
"image/png"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
"bytes"
|
||||
_ "image"
|
||||
"image/png"
|
||||
"image/gif"
|
||||
"net/url"
|
||||
|
||||
"github.com/chromedp/cdproto/emulation"
|
||||
|
||||
@ -81,13 +81,14 @@ func capture(gourl string, out http.ResponseWriter) {
|
||||
|
||||
img, err := png.Decode(bytes.NewReader(scrcap))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Printf("Failed to decode screenshot: %s\n", err)
|
||||
fmt.Fprintf(out, "<BR>Unable to decode page screenshot:<BR>%s<BR>\n", err)
|
||||
return
|
||||
}
|
||||
gifbuf.Reset()
|
||||
gif.Encode(&gifbuf, img, nil)
|
||||
|
||||
base, _ := url.Parse(loc)
|
||||
fmt.Fprintf(out, "<!-- Location: %s -->\n", base)
|
||||
fmt.Fprintf(out, "<IMG SRC=\"/wrp.gif\" ALT=\"wrp\" USEMAP=\"#map\">\n<MAP NAME=\"map\">\n")
|
||||
|
||||
for _, n := range nodes {
|
||||
|
Loading…
Reference in New Issue
Block a user