cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Clelland (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-6117) cdvfile file url is not working with html5 image src
Date Thu, 27 Feb 2014 17:19:25 GMT

    [ https://issues.apache.org/jira/browse/CB-6117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13914722#comment-13914722
] 

Ian Clelland edited comment on CB-6117 at 2/27/14 5:18 PM:
-----------------------------------------------------------

[~ritasakhuja], I think that Andrew was asking what version of Android you were actually testing
this on.

I've added a manual test to our test suite that downloads an image, creates an {{<img>}}
element, and sets its {{src}} attribute to the URL that the File plugin returns.

I've run it so far on iOS 7, Android 4.4.2, 4.3, 4.1.1 and 4.0.4, and I haven't seen any problems
yet.

My code looks basically like this (with a bit more error checking):

{code}
var filename = "feather.gif";
var imageURL = "http://apache.org/images/feather-small.gif";

requestFileSystem(TEMPORARY, 0, function(fileSystem) {
    var ft = new FileTransfer();
    ft.download(imageURL, fileSystem.root.toURL() + "/" + filename, function(entry) {
        var imgElement = new Image();
        imgElement.src = entry.toURL();
        document.getElementById("output").appendChild(imgElement);
    });
});
{code}


was (Author: iclelland):
[~ritasakhuja], I think that Andrew was asking what version of Android you were actually testing
this on.

I've added a manual test to our test suite that downloads an image, creates an {{<img>}}
element, and sets its {{src}} attribute to the URL that the File plugin returns.

I've run it so far on iOS 7, Android 4.4.2, 4.3, and 4.1.1, and I haven't seen any problems
yet.

My code looks basically like this (with a bit more error checking):

{code}
var filename = "feather.gif";
var imageURL = "http://apache.org/images/feather-small.gif";

requestFileSystem(TEMPORARY, 0, function(fileSystem) {
    var ft = new FileTransfer();
    ft.download(imageURL, fileSystem.root.toURL() + "/" + filename, function(entry) {
        var imgElement = new Image();
        imgElement.src = entry.toURL();
        document.getElementById("output").appendChild(imgElement);
    });
});
{code}

> cdvfile file url is not working with html5 image src
> ----------------------------------------------------
>
>                 Key: CB-6117
>                 URL: https://issues.apache.org/jira/browse/CB-6117
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File, Plugin File Transfer
>    Affects Versions: 3.4.0
>            Reporter: rita
>
> Hi 
> I had used the fileTranser APi to download the image from a given path.
> The image was downloaded at the path cdvfile://localhost/persistent/SPB/ics-android.png.
> But I am unable to access this image as url for <img> tag in html.Same code was
working till 2.9.0



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message