Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image: unknown format #5

Open
cospotato opened this issue Jan 17, 2018 · 1 comment
Open

image: unknown format #5

cospotato opened this issue Jan 17, 2018 · 1 comment

Comments

@cospotato
Copy link

func decode(writer http.ResponseWriter, request *http.Request) {
	imgUrl := request.URL.Query().Get("url")

	resp, err := http.Get(imgUrl)
	if err != nil {
		http.Error(writer, err.Error(), http.StatusInternalServerError)
		return
	}
	defer resp.Body.Close()

	//i, _, err := image.Decode(resp.Body)
	//if err != nil {
	//	log.Fatal(err)
	//}
	//fmt.Println(i.Bounds())

	qrMatrix, err := qrcode.Decode(request.Body)
	if err != nil {
		http.Error(writer, err.Error(), http.StatusInternalServerError)
		return
	}

	writer.Write([]byte(qrMatrix.Content))
}

This return an error: image: unknown format

@skanger
Copy link

skanger commented Aug 31, 2018

如果你的值为空,则会有这个问题
if your "url" is empty , you will get this result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants