【问题标题】:Phonegap getPhoto not workingPhonegap getPhoto 不工作
【发布时间】:2015-08-02 06:36:39
【问题描述】:

文档here 效果很好,但是当我将代码添加到我的应用程序时,getPhoto 部分返回 'content://media/external/images/media/16053' 并且不会将图像加载到 img元素,它可以很好地上传到服务器。它只是在我使用温泉的应用程序上失败了..

照片.html

<img src="{{ image }}" id="uploadImage">

app.js

$scope.onPhotoDataSuccess = function(fileURI) 
{
   console.log(fileURI);
   myNavigator.pushPage('photo.html', {animation : 'none'});

   $scope.image = fileURI;
}

我尝试向 img 元素添加 model,var 属性,但响应为 null..

【问题讨论】:

    标签: javascript angularjs cordova onsen-ui


    【解决方案1】:

    在 image tag 中使用 ng-src 而不是 src ,这样它就会在角度上下文中。 另外我相信 fileURI 是 base 64..所以你需要附加到 data:image/png;base64 到图像源!

    【讨论】:

    • 如何在我的代码中实现这一点?为什么相机部分工作正常?
    • $scope.image 中存储了什么??
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 2017-01-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多