Hello everyone I'm currently working on the submission of images on firebase storage from my spring boot api, currently everything works I can submit my images but the public url of the image is not available, I would like to know how to get a public url of my image from my api
public void uploadFile(MultipartFile multipartFile, String path) throws IOException {
String objectName = generateFileName(multipartFile);
StorageOptions storageOptions = StorageOptions.newBuilder()
.setProjectId("my-project")
.setCredentials(GoogleCredentials
.fromStream(new ClassPathResource("firebase_admin.json").getInputStream()))
.build();
Storage storage = storageOptions.getService();
BlobId blobId = BlobId.of("bucket-name", objectName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType(multipartFile.getContentType()).build();
Blob blob = storage.create(blobInfo, multipartFile.getBytes());
System.out.println("UPLOAD FILE" + multipartFile.getName() + " " + multipartFile.getSize() + " octet");
}
question from:
https://stackoverflow.com/questions/65856812/uploading-images-to-firebase-with-spring-boot 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…