从Java上传的Firebase存储映像在Firebase控制台中不显示缩略图预览 [英] Firebase Storage image uploads from Java don't show thumbnail preview in the Firebase console

查看:51
本文介绍了从Java上传的Firebase存储映像在Firebase控制台中不显示缩略图预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Java将图像上传到Firebase存储.图片已成功上传,但是当您在Firebase中看到该图片时,它不会加载...

i am trying to upload an image to firebase storage using java. The image is successfully uploaded but when you see it in the firebase it doesn't load ...

这是代码,对吗?

FirebaseOptions options = FirebaseOptions.builder().setCredentials(
            GoogleCredentials.fromStream(getClass().getResourceAsStream("/credentials.json"))).setDatabaseUrl("https://myexample.firebaseio.com")
            .setStorageBucket("myexample-123456.appspot.com").build();

    FirebaseApp fireApp = FirebaseApp.initializeApp(options);

    StorageClient storageClient = StorageClient.getInstance(fireApp);
    InputStream   testFile      = new FileInputStream(userSelection); // userselection is the image path that the user chose
    String        blobString    = "ProfilePictures/" + "TEST.png";

    storageClient.bucket().create(blobString, testFile, "image/png", Bucket.BlobWriteOption.userProject("myexample-123456"));

这是在Google Firebase上执行的结果,图像从不加载

this is the result on google firebase, the image never loads

推荐答案

这是一个已知的问题,当从后端代码上传时,图像预览不会显示在Firebase控制台中.如果文件是从Firebase客户端应用程序上传的,则效果很好.如果您有Firebase客户端请求下载URL,这也可能会起作用,下载URL将创建预览所需的URL.

It's a known issue that image previews don't display in the Firebase console when uploading from backend code. It works fine if the file was uploaded from a Firebase client app. It might also work if you have a Firebase client request a download URL, which would create the URL necessary for the preview.

我建议使用 Firebase支持提交错误报告.这是一个常见的请求.

I suggest filing a bug report with Firebase support. This is a common request.

这篇关于从Java上传的Firebase存储映像在Firebase控制台中不显示缩略图预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆