Upload images and support jpg and png image format together.

2 posts, 1 answers
  1. Bavya
    Bavya avatar
    4 posts
    Member since:
    Mar 2012

    Posted 09 Jul 2013 Link to this post

    Hi,

    I was using phonegap FileTranser API to upload images to my WCF server(KendoUI-Icenium project). I was able to upload, but the issue is I can upload either jpg or png images. Is this the way phonegap image upload will work? Its not possible to support both image format together?

    function getImage() {
                  navigator.camera.getPicture(uploadPhoto, function(message) {
                        alert('get picture failed');
                    }, {
                        quality: 50,
                        destinationType: navigator.camera.DestinationType.FILE_URI,
                        sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
                        encodingType:  Camera.EncodingType = { JPEG : 0, PNG : 1}
                    }
                 );
                }   
    This is the way I tried to get both format together. But it is not working. Please note that I have tested in Android phone..

    Thanks,
    Bavya.
  2. Answer
    Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 09 Jul 2013 Link to this post

    Hi Bavya,

     This is the way the Cordova Camera API is designed - you can take an image in one format at a time only. This is the relevant part of the Camera implementation.

     What you can do instead is to upload one version of the image to your server and there convert it to the other. However, if this isn't what you want, then you can submit an improvement request for the Camera API to Cordova's JIRA.

    Regards,
    Yavor Georgiev
    Telerik

    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Missed our first webinar, watch it here.
    Share feedback and vote for features on our Feedback Portal.
Back to Top