pui.capturePhoto correctOrientation
Posted: Thu Oct 08, 2020 8:28 am
Hi All,
I am facing an issue with a phonegap app where when I scan an image, it gets rotated by 90degress.
I came across this: https://docs.profoundlogic.com/pages/vi ... Id=8519752
What I am trying to understand is the exact location where the correctOrientation mentioned in this doc can be applied.
I have a pui.capturePhoto funciton in runtime.js and I have set this property to false in the line marked with asterisks.
Could you please tell me if I should be looking for pui.capturePhoto elsewhere? I mean, should I be doing something in the rich dspf from where we open up the camera to take a pic?
I am facing an issue with a phonegap app where when I scan an image, it gets rotated by 90degress.
I came across this: https://docs.profoundlogic.com/pages/vi ... Id=8519752
What I am trying to understand is the exact location where the correctOrientation mentioned in this doc can be applied.
I have a pui.capturePhoto funciton in runtime.js and I have set this property to false in the line marked with asterisks.
Could you please tell me if I should be looking for pui.capturePhoto elsewhere? I mean, should I be doing something in the rich dspf from where we open up the camera to take a pic?
Code: Select all
pui.capturePhoto = function (b) {
var a = b.dir;
if (a == null)
a = "/www/profoundui/htdocs/profoundui/userdata/images";
var c = b.overwrite;
if (c !== true)
c = false;
var d = b.fileName;
if (d == null)
d = "image.jpg";
var f = {};
if (b.targetWidth != null && b.targetHeight != null) {
f.targetWidth = b.targetWidth;
f.targetHeight = b.targetHeight
}
f.quality = b.quality;
if (f.quality == null)
f.quality = 50;
f.destinationType = navigator.camera.DestinationType.FILE_URI;
f.sourceType = navigator.camera.PictureSourceType.CAMERA;
f.correctOrientation = false; *************************************************************orientation
var g = b.handler;
if (g == null)
g = function (k) {
if (k.success ==
false)
pui.alert(k.error);
else
k.success == true ? pui.alert("Photo captured successfully.") : pui.alert("Invalid response.")
};
navigator.camera == null ? g({
success: false,
error: "Camera unavailable."
}) : navigator.camera.getPicture(function (k) {
var h = new window.FileUploadOptions;
h.fileKey = "file";
h.fileName = k.substr(k.lastIndexOf("/") + 1);
h.mimeType = "image/jpeg";
var l = {};
l.dir = a;
l.overwrite = c ? "1" : "0";
l.flimit = "1";
l.slimit = "50";
l.filename = d;
h.params = l;
l = new window.FileTransfer;
var p = ub("PUI0009109.PGM");
p += "?AUTH=" +
encodeURIComponent(pui.appJob.auth);
p += "&mode=ajax";
if (pui.isCloud)
p += "&workspace_id=" + pui.cloud.ws.id;
l.upload(k, encodeURI(p), function (q) {
var n = {};
try {
n = eval("(" + decodeURIComponent(q.response) + ")")
} catch (s) {
n.success = false;
n.error = "Invalid response."
}
q.success = n.success;
q.success || (q.error = n.key ? pui.getLanguageText("runtimeMsg", "upload " + n.key) : n.error);
g(q)
}, function (q) {
q.success = false;
q.error = "An error has occurred: Code = " + q.code;
g(q)
}, h)
}, function (k) {
g({
success: false,
error: k
})
}, f)
};