How to get the URL for an Image in a Members Database?

Hello,

I followed the steps for “How to Build Your Own Members Area Using Code”.

I added a field to the database where members can upload a profile picture.

I need to pass the URL for the profile picture to a third-party application for a logged on member.

Any suggestions on what code I would use to dynamically retrieve the URL of a member’s profile picture in a database when he/she is logged in?

Thanks in advance!

Here is a start for you.

export function getImageUrl(imageSRC)
{
 if (imageSRC.startsWith("wix:image://") || imageSRC.startsWith("image://")){    
        console.log(imageSRC);
 let regexp = /.+?(?=.png)/;
 var newimagesrc = regexp.exec(imageSRC)[0]; 
        newimagesrc = newimagesrc.replace('wix:image://v1/', '');
        newimagesrc = newimagesrc.replace('image://v1/', '');
        newimagesrc = newimagesrc.replace('/', ''); 
 let wixImageURL = "https://static.wixstatic.com/media/";    
 return wixImageURL + newimagesrc + ".png";
    } 
 return imageSRC;
}

Hey Andreas ! thanks for your answer! any idea of how can I use this to download all the images on the database collection? Thanks in advance