Image and Download problem


I just test to download something in my web but it can’t display image and can’t download the file.
<.img scr=“image_tag(shawnmendes.jpg)” alt=“Shawn Mendes”>
<.a href="/shawnmendes/thatsnothingholdingmeback.mp3" download>Download


While I’m not entirely sure what workspace type, language, and frameworks you are using, I’ll try to fix your code. First of all, image_tag is (IIRC) an Express Helper, but here it’s not necessary. If you’re using express and templating with EJS, for instance, then change <.img scr="image_tag(shawnmendes.jpg)” alt=“Shawn Mendes”> to just <% image_tag("shawnmendes.jpg") %>. Since you already have an image tag, you could just remove the helper function and type the source by itself (also correcting scr to src, and removing the dot after <): <img src=“shawnmendes.jpg” alt=“Shawn Mendes”>. It’s also important to understand relative URLs; if you have just shawnmendes.jpg as the source, it will resolve to the current URL plus /shawnmendes.jpg (e.g. if your current URL is, it will resolve to If you change it to /shawnmendes.jpg it will resolve to no matter what page you are on. In order to comply with the HTML spec, also add a / at the end of the image tag, like <img src=“shawnmendes.jpg” alt=“Shawn Mendes” />.

For the link, remove the dot after the <, and keep in mind that most tags (with img and some others being an exception), require a closing tag, for instance a heading: <h1>Heading</h1>. That means that your link HTML should be <a href="/shawnmendes/thatsnothingholdingmeback.mp3" download>Download</a>. Also, according to the spec on MDN, you can add a different filename for the file to be downloaded, by changing it to this: <a href="/shawnmendes/thatsnothingholdingmeback.mp3" download="shawnmendesrocks.mp3">Download</a>.

The finished product should look something like this:

<img src=“shawnmendes.jpg” alt=“Shawn Mendes” />
<a href="/shawnmendes/thatsnothingholdingmeback.mp3" download>Download</a>