Skip to content

image: unknown format #5

Open
Open
@cospotato

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions