Base64 & Downgrading Icenium ion to 2.4.0

4 posts, 1 answers
  1. Mohammad
    Mohammad avatar
    20 posts
    Member since:
    Feb 2013

    Posted 09 Jul 2013 Link to this post

    Cordova 2.7.0 has a problem with base64 and thus makes my application fails when trying to process images. Bug found in here
    mail-archives.apache.org/mod_mbox/cordova-issues/201304.mbox/<JIRA.12644261.1366766957447.228283.1366935735616@arcas>
    but when i try to down grade to 2.4.0 Icenium ion tells me that this version does  not supports 2.4.0 it only supports 2.7.0,
    Is there any way to down grade cordova ? else where how can i fix this problem ?
  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 09 Jul 2013 Link to this post

    Hi Mohammad,

    I have looked at the Cordova issue you have pointed out, but it seems to be resolved in 2.7. Shazron from the Cordova team has commented here, that the problem was in the clients code where FileEntry object was used instead of File. Can you please share a simple code snippet that illustrates the issue on your end?

    Regarding Icenium Ion it works only with the latest version of Cordova that Icenium supports, which currently is 2.7, so if you want to use Ion you should use the latest version. For provisioned applications you can use only of the Cordova version that Icenium supports.

     

    Hope this helps,
    Stefan Dobrev
    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.
  3. Mohammad
    Mohammad avatar
    20 posts
    Member since:
    Feb 2013

    Posted 09 Jul 2013 Link to this post

    var imageToBase64 = function (name, it) {
            return new $.Deferred(function (def) {
                var gotFS = function (source) {
                    source.root.getDirectory("images", { exclusive: false }, function (source) {
                        source.getFile(name, null, function (file) {
                            var reader = new FileReader();
                            reader.onloadend = function (e) {
                                console.log("loaded");
                                def.resolve([e.target.result.substr(23, e.target.result.length), it]);
                            };
                            reader.readAsDataURL(file);
                        }, error);
                    }, error);
                };
                var error = function (error) {
                    def.reject(error);
                };
                window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, error);
            }).promise();
        };

    here's my code its actually being loaded but the value is empty.
    Ill try to use file instead of fileEntry and get back with the results. By the way my code works fine with 2.4.0
  4. Answer
    Mohammad
    Mohammad avatar
    20 posts
    Member since:
    Feb 2013

    Posted 09 Jul 2013 Link to this post

    var imageToBase64 = function (name, it) {
            var def = new $.Deferred();
            var gotFS = function (source) {
                source.root.getDirectory("images", { exclusive: false }, function (source) {
                    source.getFile(name, null, function (file) {
                        var reader = new FileReader();
                        reader.onloadend = function (e) {
                            def.resolve([e.target.result.substr(23, e.target.result.length), it]);
                        };
                        file.file(function (fileObj) {
                            reader.readAsDataURL(fileObj);
                        }, error);
                    }, error);
                }, error);
            };
            var error = function (error) {
                def.reject(error);
            };
            window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, error);
            return def.promise();
        };

    WORKED LIKE A CRYSTAL !! THANKS!
Back to Top