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

Question:

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!

What am I doing wrong here?

Asked By: sushant patil

||

Answers:

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.

Answered By: Ayoub BEL MEHDI
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.