从 Java 上传的 Firebase 存储图像不在 Firebase 控制台中显示缩略图预览
Firebase Storage image uploads from Java don't show thumbnail preview in the Firebase console
我正在尝试使用 java 将图像上传到 firebase 存储。图片已成功上传,但当您在 firebase 中看到它时,它没有加载...
这是代码,正确吗?
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 的结果,图片永远不会加载
从后端代码上传时,图像预览不会显示在 Firebase 控制台中,这是一个已知问题。如果文件是从 Firebase 客户端应用程序上传的,则它工作正常。如果您有 Firebase 客户端请求下载 URL,它也可能有效,这将创建预览所需的 URL。
我建议使用 Firebase support 提交错误报告。这是一个常见的要求。
我正在尝试使用 java 将图像上传到 firebase 存储。图片已成功上传,但当您在 firebase 中看到它时,它没有加载...
这是代码,正确吗?
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 的结果,图片永远不会加载
从后端代码上传时,图像预览不会显示在 Firebase 控制台中,这是一个已知问题。如果文件是从 Firebase 客户端应用程序上传的,则它工作正常。如果您有 Firebase 客户端请求下载 URL,它也可能有效,这将创建预览所需的 URL。
我建议使用 Firebase support 提交错误报告。这是一个常见的要求。