Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Firebase photo upload, Google not recognizing it as an image

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22731

    Eric

    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

    #22743

    Alex
    Felgo Team

    Hi Eric,

    thanks for this report. I’ll have to forward this to the plugin development team and hope to get an aswer for you shortly.

    Cheers,
    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded