我无法使用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