Hello,
I’m using the Firebase plugin along with nativeUtils.displayImagePicker and nativeUtils.displayCameraPicker to upload images to the Firebase Storage via uploadFile. However, when I do this, Google doesn’t see the image as an image file but shows it as Type: “application/octet-stream”, whereas if I upload an image directly through the Firebase Console is sees it as Type: “image/jpeg”. I wouldn’t normally mind but I added the “Resize Images” extension to the console and it doesn’t see the images uploaded through Felgo as images and therefore doesn’t resize them (images I manually upload through the console are resized as expected).
So, if there is a way to automatically resize images before uploading them, that would work well, otherwise, is there a way to get Google Firebase to recognize images as actual images? I’m using the code provided on this website.
AppButton {
text: "Add Photo from Gallery"
flat: false
onClicked: {
nativeUtils.displayImagePicker("Pick Image")
}
}
Connections {
target: nativeUtils
onCameraPickerFinished: {
if(accepted) {
uploadImage(path)
}
}
onImagePickerFinished: {
if (accepted) {
uploadImage(path)
}
}
function uploadImage(path) {
var remote_path = "users/" + dataModel.user_id + "/test-image" + Date.now() + ".jpg"
fbStorage.uploadFile(path, remote_path,
function (progress, finished, success, downloadUrl) {
console.debug("uploadFile")
if (!finished) {
status.text = "Uploading... " + progress.toFixed(2) + "%"
} else if (success) {
console.debug("downloadUrl: ", downloadUrl)
status.text = "Upload complete"
photoModel.append({p: path})
} else {
status.text = "Upload failed"
}
})
}
}
Thank you,
Eric