<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic FWIW, I have found the in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034605#M43435</link>
    <description>&lt;P&gt;FWIW, I have found the Cordova plugin has similar orientation issues on iOS. I think it actually worked ok with with correctOrientation flag set under one of the 8.0.x or 8.1.x versions but then started being troublesome again.&lt;/P&gt;

&lt;P&gt;Workarounds include implementing an image rotate feature for the end user and optionally detecting iOS and setting the initial rotation oneself.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2015 14:38:22 GMT</pubDate>
    <dc:creator>Barry_Johnson</dc:creator>
    <dc:date>2015-03-20T14:38:22Z</dc:date>
    <item>
      <title>Camera image orientation and problems with base64 encoding / iOS</title>
      <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034600#M43430</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm having trouble with the photo-taking and uploading portion of an app I'm working on. At the moment, I'm concentrating on iOS (specifically, I'm testing on an iPhone 4, iOS 6). The issue occurs when the app base64 encodes the image in order to later upload that string (data URL). In landscape-left, the encoded image is OK. In landscape-right, the image is upside down. In portrait, the image gets squeezed &amp;nbsp;horizontally (reduced to width/height fraction of its full width), then a vertical black bar is added to return it to full width, then it's rotated -90deg into landscape orientation (reduced-size sample photo attached). I'm thinking this has something to do with the fact that iOS reports the same image dimensions (w=2592, h=1936) regardless of whether the image was taken in portrait or landscape.&lt;/P&gt;

&lt;P&gt;If I could capture the physical device orientation while the photo is being taken, that might help, but I haven't been able to do that either (app is fixed in portrait mode and querying device orientation always returns 0 - and anyhow that's not captured during image capture).&lt;/P&gt;

&lt;P&gt;Any help would be much appreciated. The heart of the photo-taking and encoding code is below.&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="photo.jpg"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/7019i0251976482D90D4F/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="photo.jpg" alt="photo.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;//Camera button functionality
ksApp.takepicture = function()
{
    if (ksApp.photoUploadInProgress) return;
    intel.xdk.camera.takePicture(80, true, "jpg");
}


//Event listener for camera
document.addEventListener("intel.xdk.camera.picture.add",takepicOnSuccess); 
document.addEventListener("intel.xdk.camera.picture.busy",takepicOnSuccess); 
document.addEventListener("intel.xdk.camera.picture.cancel",takepicOnSuccess); 


function takepicOnSuccess(event) 
{
    if (event.success === true)
    {
        $.ui.showMask("Processing photo");

        // get the photo file url from the camera object
        var imagesrc = intel.xdk.camera.getPictureURL(event.filename);
        ksApp.photograph.Url = imagesrc;
        
        // construct the base64-encoded data-url of the photo
        var imgObj = new Image();
        imgObj.src = imagesrc;
        var imgDataUrl;
        $(imgObj).load(function(){
            //wait for image to load before computing base64 encoded data url
            imgDataUrl = getBase64ImageDataUrl(imgObj);
            ksApp.photograph.Base64ImageDataUrl = imgDataUrl;
            
            // store the photo object in local storage
            ksShared.localStorage_setItem(ksApp.photographKey, JSON.stringify(ksApp.photograph));

            // display the photo
            var pic = document.getElementById("photograph-img");
            //pic.src = imagesrc;
            pic.src = imgDataUrl;
            $('#photograph-img').css('display','block');
            
            // clear the processing mask
            $.ui.hideMask();
        });        
    }
    else
    {
        if (event.message !== undefined)
        {
            alert(event.message);
        }
        else
        {
            alert("Error capturing picture");
        }
    }
}


function getBase64ImageDataUrl(img) {
    var canvas, ctx, dataURL;

    canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;
    
    // Copy the image contents to the canvas
    ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0, img.width, img.height);
    
    // Get the data-URL formatted image
    dataURL = canvas.toDataURL("image/jpeg");
    return dataURL;
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2014 16:56:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034600#M43430</guid>
      <dc:creator>Jerry_A_</dc:creator>
      <dc:date>2014-08-28T16:56:10Z</dc:date>
    </item>
    <item>
      <title>Nobody has encountered</title>
      <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034601#M43431</link>
      <description>&lt;P&gt;Nobody has encountered anything like this before?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2014 15:59:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034601#M43431</guid>
      <dc:creator>Jerry_A_</dc:creator>
      <dc:date>2014-09-08T15:59:14Z</dc:date>
    </item>
    <item>
      <title>I have seen this problem</title>
      <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034602#M43432</link>
      <description>&lt;P&gt;I have seen this problem before, but I'm do not recall the solution. I would try using the Cordova camera plugin to see if it resolves this issue (and use the Cordova build system). If it does not, then search for "PhoneGap Cordova camera orientation" and you should find some relevant results.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Sep 2014 19:38:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034602#M43432</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2014-09-20T19:38:44Z</dc:date>
    </item>
    <item>
      <title>I am also facing the same</title>
      <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034603#M43433</link>
      <description>&lt;P&gt;I am also facing the same issue. I am using my Samsung Tab S, and when capturing the image from device in portrait mode, image is getting in landscape mode. I can set orientation of device in portrait or landscape, but don't know how to set orientation for camera image capture. I am not getting this issue in my iPhone 5S, but getting issue in Android Tab.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 04:41:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034603#M43433</guid>
      <dc:creator>Rajesh_M_1</dc:creator>
      <dc:date>2015-03-20T04:41:04Z</dc:date>
    </item>
    <item>
      <title>I believe this is related to</title>
      <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034604#M43434</link>
      <description>&lt;P&gt;I believe this is related to the intel.xdk.camera functions. Switch to the cordova camera api and it should fix the issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 13:41:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034604#M43434</guid>
      <dc:creator>John_H_Intel2</dc:creator>
      <dc:date>2015-03-20T13:41:57Z</dc:date>
    </item>
    <item>
      <title>FWIW, I have found the</title>
      <link>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034605#M43435</link>
      <description>&lt;P&gt;FWIW, I have found the Cordova plugin has similar orientation issues on iOS. I think it actually worked ok with with correctOrientation flag set under one of the 8.0.x or 8.1.x versions but then started being troublesome again.&lt;/P&gt;

&lt;P&gt;Workarounds include implementing an image rotate feature for the end user and optionally detecting iOS and setting the initial rotation oneself.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 14:38:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Camera-image-orientation-and-problems-with-base64-encoding-iOS/m-p/1034605#M43435</guid>
      <dc:creator>Barry_Johnson</dc:creator>
      <dc:date>2015-03-20T14:38:22Z</dc:date>
    </item>
  </channel>
</rss>

