Skip to content

Unable to use Firebase Resize Image Extension when uploading from Unity SDK #23

@ChristianMcFarlaneWork

Description

@ChristianMcFarlaneWork

Unity Version: Unity 2019.4.28f1
Firebase SDK version: 7.2.0

Hopefully this is the right place for this issue.

We're trying to use the Resize Image Extension with the Unity Firebase SDK to generate thumbnails to upload to our storage. However the extension is never being called even after setting custom metadata to ensure that our content-type is correct.

The code we've been using is along the lines of this

byte[] imageBytes = previewTexture.EncodeToPNG();
MetadataChange metadata = new MetadataChange() { ContentType = "image/png" };
bucket.Child("CustomMaps/UserId/Previews/MapID.png").PutBytesAsync(imageBytes, metadata);

And this is what we see in the logs for our image upload

Function execution started 
---
Started execution of extension with configuration {"bucket":"CorrectAppBucket","deleteOriginalFile":1,"imageSizes":["128x128"],"imageTypes":["false"],"includePathList":["/CustomMaps/*/Previews"]}
--
File of type 'application/x-www-form-urlencoded' is not an image, no processing is required
--
Function execution took 7 ms, finished with status: 'ok'  

But looking at the metadata in the dashboard shows that the metadata was set correctly, with our Content-Type showing up as 'image/png'.

We think that it's an issue with the SDK and setting the metadata after the file has already been finalized on the server end and the function has already been invoked. However other than that we are in the dark as to why this is happening,.

For now we are forced to manually generate smaller versions on client-side which is much slower on mobile and will eat up more of our bandwidth, so we are looking to get a fix for this issue to avoid that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions