1
0
Fork 0
mirror of https://github.com/Luzifer/cam2mjpeg.git synced 2024-12-21 01:41:18 +00:00

Revert: Add base64 encoding of image

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-04-29 12:03:57 +02:00
parent cf28f4729d
commit 8d7625aacd
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -1,7 +1,6 @@
package main
import (
"encoding/base64"
"fmt"
"mime/multipart"
"net/http"
@ -39,18 +38,13 @@ func handleMJPEG(res http.ResponseWriter, r *http.Request, imgs chan []byte, uid
err := func() error {
partHeader := make(textproto.MIMEHeader)
partHeader.Add("Content-Type", "image/jpeg")
partHeader.Add("Content-Transfer-Encoding", "base64")
partWriter, err := mimeWriter.CreatePart(partHeader)
if err != nil {
return errors.Wrap(err, "Unable to create mime part")
}
b64w := base64.NewEncoder(base64.StdEncoding, partWriter)
defer b64w.Close()
_, err = b64w.Write(img)
_, err = partWriter.Write(img)
return errors.Wrap(err, "Unable to write image")
}()