I created an app and when I upload an Image I'm storing in a database the "Storage Location" of the file
Storage location gs://******/carriersPictures/calinonaca1@gmail.com-profilePicture-1570123057815.jpg
for example, I store this because I didn't find a function to store the download URI only the Storage Location of file using this
picturesUrls.add(taskSnapshot.getUploadSessionUri().toString());
But, I want to display those images in a web page. I'm using NodeJs as backend with template view EJS. But how can I convert in the NodeJs app the Storage Location URI to download URI.
exports.getApprove = (req,res,next) => {
const email = req.params.email;
const ref = firebase.database().ref("User");
ref.orderByChild("email").equalTo(email).on("child_added", function(snapshot) {
let pictureUrls = [];
for(let i = 0 ;i < snapshot.val().picturesUrls.length ;i++) {
pictureUrls.push(snapshot.val().picturesUrls[i]);
}
const user = {
CVC: snapshot.val().CVC,
activated: snapshot.val().activated,
address: snapshot.val().address,
cardnumber: snapshot.val().cardnumber,
city: snapshot.val().city,
cnp:snapshot.val().cnp,
country:snapshot.val().country,
email:snapshot.val().email,
expiredate:snapshot.val().expiredate,
fullname:snapshot.val().fullname,
password:snapshot.val().password,
phone:snapshot.val().phone,
pictureUrls: pictureUrls,
rate: snapshot.val().rate,
state: snapshot.val().state,
type: snapshot.val().type,
zipcode :snapshot.val().zipcode
}
res.render('main/approve', {
pageTitle:'Drivie | APPROVE',
path:'/aprove',
user:user
});
});
}
I want picturesUrls array to get the Download URLs not the Storage Location. I mean, I know in my database I store the Storage Locations of the images, but how can I query the storage for every Storage Location URL to get the Download URL. Didn't find too much in the official docs.
Thank you very much!