How to get previw image url that is available with <img> tag

SkillUP AS 20 Reputation points
2024-01-29T10:47:34.59+00:00

Hi, I'm attempting to show the preview image on my React app. I tried to use Url with 'https://{accountName}'.blob.core.winodws.net/{containerName}/{blobName} and I also tried the url with Sas token. ( I got it from generateSasUrl) Both doesn't work with <img> html tag. What url should I use for the tag? and How can I get the url with container and image name? BTW, Images are uploaded using uploadBrowerData

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
{count} votes

2 answers

Sort by: Most helpful
  1. shiva patpi 13,366 Reputation points Microsoft Employee Moderator
    2024-01-29T23:59:02.69+00:00

    Hello SkillUP AS, I just tried below piece of React code with the html tag and the image is getting extracted from the storage container (like below) User's image

    To get the URL for the storage container blob image User's image

    Regards, Shiva.


  2. Anand Prakash Yadav 7,855 Reputation points Microsoft External Staff
    2024-01-30T10:22:32.34+00:00

    Hello SkillUP AS, Thank you for posting your query here!

    Your image should be able to show on your page with:

    <img src="the_url_of your_image">

    You could access blob with Blob URL(https://{storage-name}.blob.core.windows.net/{container-name}/{test.png}) when your image blob is public.

    User's image

    If the access level is private, you could access the image blob with SAS. And the URL looks like https://{storage-name}.blob.core.windows.net/{container-name}/{test.png}?{Blob SAS token}.

    Do let us know if you have any further queries. I’m happy to assist you further.

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.