Golang某些图片在图片上传时旋转

I am facing a rather weird problem, I am using Golang as a backend restful API and I upload images and resize them with Go . I have an app for I-phone that I am testing and if I upload an image using my real device the image gets saved in my s3 account sideways. For some reason resizing my image is rotating it, however if I upload the image from my Xcode IDE then the image gets saved correctly without rotation . I am thinking that maybe something is getting stripped however I have no idea what that could, my code is this

func UploadStreamImage(w http.ResponseWriter, r *http.Request) {
    r.ParseForm()
    var buff bytes.Buffer
    var result string

    wg := sync.WaitGroup{}
       print("Exoler-Streams")
    wg.Add(1)
    go func() {
        defer wg.Done()


        sess, _ := 's3 credentials'

        svc := s3.New(sess)

        file, handler, err := r.FormFile("file")
        if err != nil {
            fmt.Println("Error Uploading Image")
            return
        }
        defer file.Close()
        // resize image
        img,err := imaging.Decode(file)
        if err != nil {
            print("Imaging Open error")
        }
        new_image := imaging.Resize(img, 300, 300, imaging.Lanczos)
        var buf bytes.Buffer


        err = imaging.Encode(&buf,new_image, imaging.JPEG)
        if err != nil {
            log.Println(err)
            return
        }

        // end resize

        r := bytes.NewReader(buf.Bytes())





        read_file,err := ioutil.ReadAll(r)
        if err != nil {
            fmt.Println("Error Reading file")
               }
    // s3 specific code
        }

The library I am using is this https://github.com/disintegration/imaging and I am just thinking that something is being stripped when uploading the image from my real device thus it is messing up the rotation . The code on the front-end is all the same for my real device and Xcode .

The image is not being rotated in the process, the original image was shown in some image view software in rotated mode depending on the image orientation tag (val x00112) in the Exif part of the file. When you strip the Exif part, as image package does, you lose that information and the image is shown in standard camera orientation format (landscape).