Photo rotated only on Samsung


Dear colleagues of this group. I have not been able to solve a problem for several days. I have an application (.apk on Android) that, among other things, allows you to take a photo and upload it to a server. My problem is that in any cell phone it works well but in Samsung phones, the photo is shown rotated with its corresponding deformation. I would like to know if you can help me by commenting on an alternative solution. Use “ (onPictureReturned, onPictureError, options)” to take the photo.

Please notice the last option: {
        }, function(message) {
        }, { quality: Number(getPhotoQuality()), destinationType: Camera.DestinationType.FILE_URI, correctOrientation: true});

p.s. getPhotoQuality() is one of my functions and allows the user to set a default photo quality through their user settings.

Thanks PPetree, for your quick response. It is a relief to have some help. I am programming in Basic, should I transform the syntax or can java code be added? Could you give me an example? Very kind for your answer. Regards.

Here it is BASIC (air code)

Function success(imageData)
   ' do something
End Function

Function fail(message)
   ' do something
End Function

options = {quality: Number(getPhotoQuality()), destinationType: Camera.DestinationType.FILE_URI, correctOrientation: true}, fail, options)

Thank you support for your response. It is the code I am using and it works very well. My problem is that in Samsung phones the image is shown rotated and in other phones not. I don’t know if I have to touch any configuration on the cell phone or I can determine the orientation by program. From already thank you very much!

Function Button_Foto_onclick()
  bbForma = True
  options={quality : 100, destinationType : 1, sourceType : 1, allowEdit : False}, onPictureError, options)
End Function

Function onPictureReturned(ImageURI)

  Dim pb

  pb = PictureBox1.getContext("2d")
  TextArea_Uri.value = encodeURIComponent(PictureBox1.toDataURL("image/jpeg"))
  Image_Scan.src = ImageURI

'  pb2 = PictureBox1.getContext("2d")
'  rotation = (rotation + 90) % 360;
'  If (rotation % 180) <> 0 Then ' portrait
'     PictureBox1.resize(48, 100, 225, 300)
'  Else ' landscape
'     PictureBox1.resize(10, 128, 300, 225)
'  End If
'  pb2.translate(PictureBox1.width / 2, PictureBox1.height / 2)
'  pb2.rotate(rotation * Math.PI / 180)
'  imgObj = PictureBox1.img
'  NSB.drawImageIOSFix(pb, imgObj, 0, 0, 0, 0, -150, -112, 300, 225)
'  pb2.restore()
End Function

Function onPictureError(message)
  MsgBox "Falló porque " & message
End Function

I wanted to try to rotate the image by program without positive result

You sure you have all of those options set?

Read this

This has a manual workaround. Best I remember the samsung images uploaded correctly.

Thanks PPetree for your comment. It has helped me to improve my application, but I have not solved the problem. I am focusing on rotating the image, but now I find out how to determine by software, when a photo is rotated or not. Regards.