0

我无法使用coffeescript通过画廊通过触发器上传图像

相关代码:

主脚本:

CameraHelper.fileUpload (file) =>
    @file = file
    forge.file.URL file, (url) =>
        @fileURL = url
        @$("#uploadImg").addClass("fadeIn").css("background-image", "url(#{url})")
    , (content) ->
        error "Error finding Image"
    , ->
        debug "Upload Cancelled"

相机助手:

fileUpload: (success, err) ->
    forge.file.getImage
        saveLocation: "file"
    , (file) ->
            debug "Successfully uploaded img"
            success?(file)
    , (content) ->
            error "Error in uploading img", content
            err?()

相关调试信息:

选择并拍摄相机时:

[FORGE] '{"uri":"/var/mobile/Applications/1BC9C0D7-5830-402E-913A-C39764B41F26/Library/Application Support/Forge/389301995108.jpg","name":"Image","type":"image"}'
all.js:2[FORGE] 'Successfully uploaded img'

选择图库图像时:

assets-library://asset/asset.JPG?id=A3907A31-A8F9-4763-AEF2-67BA84F8E245&ext=JPG 
Failed to load resource: unsupported URL
4

1 回答 1

1

解决。

必须添加 forge.file.URL 函数才能正确访问图像的 URL

更多细节在这里

于 2013-05-07T17:46:40.563 回答