iOS Cordova 3.5.0 camera.getPicture targetWidth issue

9 posts, 0 answers
  1. Žygimantas
    Žygimantas avatar
    2 posts
    Member since:
    Dec 2014

    Posted 07 Dec 2014 Link to this post

    I use iOS 8.1.1 with the latest companion app.

    If I pass  { 'destinationType': navigator.camera.DestinationType.DATA_URL} to the camera.getPicture method, it works file, but the image data size is huge.
    I don't need high resolution and I decided to provide targetWidth and targetHeight options to get smaller photos.

    But once I add these options like this: { 'destinationType': navigator.camera.DestinationType.DATA_URL, 'targetWidth': 480, 'targetHeight': 640} the camera.getPicture method returns nothing. No code in success or error callbacks is executed. Just nothing happens.

    What might be wrong?
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 10 Dec 2014 Link to this post

    Hi Žygimantas,

    This is a known issue within the companion app which comes from the specifics of the Camera plugin and the location services on iOS8 devices.

    We plan to push a fix to the companion app that works around this behavior. In the meantime, there is a simple fix you can apply in your application. You can add another CameraOptions property next to the one for targetWidth and targetHeight : encodingType: Camera.EncodingType.PNG:

    var config = {
        destinationType: Camera.DestinationType.DATA_URL,
        targetHeight: 400,
        targetWidth: 400,
        encodingType: Camera.EncodingType.PNG
    };

    Give this a try and let me know if it helps.

    Regards,
    Tina Stancheva
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Žygimantas
    Žygimantas avatar
    2 posts
    Member since:
    Dec 2014

    Posted 10 Dec 2014 in reply to Tina Stancheva Link to this post

    Thanks! That's a good trick.
  4. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 11 Dec 2014 Link to this post

    Hi Žygimantas,

    I am glad it helps, but keep in mind that changing the encoding type to PNG will make your camera take pictures with no EXIF information (such as where the picture was taken). This is exactly the reason why this line helps overcome the issue until we address it.

    Regards,
    Tina Stancheva
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  5. nalini
    nalini avatar
    2 posts
    Member since:
    Jun 2015

    Posted 12 Jun 2015 in reply to Tina Stancheva Link to this post

    I used the same option. Still it is unresponsive after image captured. any way to free the memory. 
  6. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 17 Jun 2015 Link to this post

    Hi Nalini,

    The issue discussed in this thread was resolved a while ago. Can you please submit a support ticket and attach your project there so we can investigate the issues you are having. We would also need to know the steps we can follow to reproduce the behavior you described.

    Regards,
    Tina Stancheva
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  7. nalini
    nalini avatar
    2 posts
    Member since:
    Jun 2015

    Posted 17 Jun 2015 in reply to Tina Stancheva Link to this post

    Thanks, Tina.. I have resolved the issue by giving the targetheight.

    Here is my working code 

    navigator.camera.getPicture(onSuccess, onFail, {

                    quality: 50,
    targetWidth: 600,
    targetHeight: 600,
    encodingType: Camera.EncodingType.PNG,
                    correctOrientation: true,
                    destinationType: destinationType.DATA_URL
                });

     

     

  8. Lingaraj
    Lingaraj avatar
    1 posts
    Member since:
    Feb 2016

    Posted 05 Feb in reply to Tina Stancheva Link to this post

    Hi,

    i am facing same issue .photo is not displaying after click on use photo option complete blank page appears.

    here is my code .its hybrid application its working on android device fine problem with ios device only.

    var config = {
        destinationType: Camera.DestinationType.FILE_URI,
        targetHeight: 400,
        targetWidth: 400,
        encodingType: Camera.EncodingType.PNG
    };

  9. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 10 Feb Link to this post

    Hi Lingaraj,

    Can you replicate the issue in the Camera sample app. I've tried on my side but capturing photos seem to work as expected even with the configuration you specified. The photo is captured and then displayed in the app.

    If you can replicate the problem, please submit a support ticket and provide us with a small sample where we can see the issue or with the list of steps we can follow to replicate it in the sample Camera app.

    Regards,
    Tina Stancheva
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top