Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

not able to display image using a variable to store image URL

enter image description here

I have stored the image URL in cover_url variable.

When I display the image using the variable, its broken but when I paste directly the URL, it works!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

What am I doing wrong here?

>Solution :

You forgot to add the quotes for the html to know that the src attribute is a string.
This the output when you print the variable.

<center><img src=https://i.scdn.io/... /></center>

This way, what comes after your src attribute isn’t considered as a string.
The solution in your case would be just by adding the quotes symbol.

<center><img src="{cover_url}" /></center>

Hope this was helpful.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading