pui.capturePhoto correctOrientation

Use this board for starting discussions, asking questions, and giving advice on Web programming for the IBM i platform (and predecessors.)
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

pui.capturePhoto correctOrientation

Post by Theju112 »

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?

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)
};

Who is online

Users browsing this forum: No registered users and 3 guests