Forums

OverviewFelgo 2 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support