The contents of the multipart.File are as follows: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD..."
I'm trying to get it into the Image.DecodeConfig() method like this:
import (
"image"
"image/jpeg"
"io"
)
func ImgCheckSize(file io.Reader) (io.Reader, error) {
config, format, err := image.DecodeConfig(file)
...
The error prints: "image: unknown format"
I've also printed out the multipart.FileHeader.Header which reads:
map[Content-Disposition:[form-data; name="img1"; filename="img1"] Content-Type:[application/octet-stream]]
Has anyone come across this before? Any useful suggestions would help! Many many thanks
Solved with the following package: "github.com/vincent-petithory/dataurl"
for example:
imgdecoded, _ := dataurl.Decode(imgupload)