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:
parent
cf28f4729d
commit
8d7625aacd
1 changed files with 1 additions and 7 deletions
8
mjpeg.go
8
mjpeg.go
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -39,18 +38,13 @@ func handleMJPEG(res http.ResponseWriter, r *http.Request, imgs chan []byte, uid
|
||||||
err := func() error {
|
err := func() error {
|
||||||
partHeader := make(textproto.MIMEHeader)
|
partHeader := make(textproto.MIMEHeader)
|
||||||
partHeader.Add("Content-Type", "image/jpeg")
|
partHeader.Add("Content-Type", "image/jpeg")
|
||||||
partHeader.Add("Content-Transfer-Encoding", "base64")
|
|
||||||
|
|
||||||
partWriter, err := mimeWriter.CreatePart(partHeader)
|
partWriter, err := mimeWriter.CreatePart(partHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Unable to create mime part")
|
return errors.Wrap(err, "Unable to create mime part")
|
||||||
}
|
}
|
||||||
|
|
||||||
b64w := base64.NewEncoder(base64.StdEncoding, partWriter)
|
_, err = partWriter.Write(img)
|
||||||
defer b64w.Close()
|
|
||||||
|
|
||||||
_, err = b64w.Write(img)
|
|
||||||
|
|
||||||
return errors.Wrap(err, "Unable to write image")
|
return errors.Wrap(err, "Unable to write image")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue