Tôi đang chụp ảnh (hoặc chọn từ thư viện) sử dụng PhoneGap API sử dụng drictive sau:nội dung tải hình ảnh từ máy ảnh vào một tập tin
MyApp.directive('Camera', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
elm.bind('click', function() {
navigator.camera.getPicture(function (imageURI)
{
scope.$apply(function() {
ctrl.$setViewValue(imageURI);
});
}, function (err) {
ctrl.$setValidity('error', false);
},
//Options => http://docs.phonegap.com/en/2.6.0/cordova_camera_camera.md.html#Camera
{ quality: 50,
destinationType:Camera.DestinationType.FILE_URI
})
});
}
};
});
nào trả lại cho tôi một URI đó trông như thế nào, sử dụng giả lập gợn trên chrome, mà tôi không thể thấy dán URI này.
blob:http%3A//localhost%3A8080/8e18de30-d049-4ce2-ae88-8500b444581e
Vấn đề của tôi đang tải URI này
$scope.updateUserProfile = function (user) {
var myPicfile = $http.get(user.myPicture);
dataService.uploadPicture . . . some code to update the picture to Parse
}
* Lưu ý: I cannot use phonegap filetransfer together with parse.com :
Khi tôi làm điều đó tôi nhận được:
Tôi đang làm cho yêu cầu của tôi như :
tải lênẢnh: chức năng tải lênẢnh (người dùng, gọi lại) { var serverUrl = 'https://api.parse.com/1/files/' + user.Nick;
$http({
method: 'POST',
url: serverUrl,
data: user.myPicture,
headers: {'X-Parse-Application-Id': PARSE_APP_ID,
'X-Parse-REST-API-Key': PARSE_REST_API_KEY,
'Content-Type': 'text/plain'
}
})
Bất kỳ ý tưởng nào về cách tải nội dung của hình ảnh lên tệp mà tôi có thể tải lên Parse.com một cách hạnh phúc?
Cảm ơn!
Kiểm tra này [Lưu trữ chụp ảnh trên thẻ SD] (http://stackoverflow.com/questions/14928202/save-image-in-local-storage-phonegap/16648829#16648829) –