Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Image Picker plugin send empty image to Firebase storage #1426

Open
alkahtani opened this issue Apr 5, 2017 · 0 comments
Open

Image Picker plugin send empty image to Firebase storage #1426

alkahtani opened this issue Apr 5, 2017 · 0 comments

Comments

@alkahtani
Copy link

Sorry for my bad english , first i don't know where to post this issue looking for help , i tried my best with no luck , the issue i have when i send images to Firebase storage it's keep loading and doesn't show anything and all the images size the same "15 b". It gives me empty images and when I try to open the download URL, it show nothing.

`function uploadPicture(options) {
$cordovaCamera.getPicture(options).then(function (sourcePath) {
var sourceDirectory = sourcePath.substring(0, sourcePath.lastIndexOf('/') + 1);
var sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1, sourcePath.length);
sourceFileName = sourceFileName.split('?')[0];
$cordovaFile.copyFile(sourceDirectory, sourceFileName, cordova.file.dataDirectory, sourceFileName)
.then(function (success) {
$scope.uploadedImage = cordova.file.dataDirectory + sourceFileName;
// success - get blob data
var imageBlob = new Blob([success], { type: "image/png" });
alert (sourceFileName)
return saveToFirebase(imageBlob, sourceFileName);
}).then(function (_responseSnapshot) {
// we have the information on the image we saved, now
// let's save it in the realtime database
return saveReferenceInDatabase(_responseSnapshot)

 }, function (error) {
  alert(error);
});

}, function (err) {
alert(err);
});
};`

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant