Forums

Unable to render a image inside the html file

Hi,

We are trying to display an image on the browser when Home.html page is accessed. Following is the code of Home.html

<html>
    <title>Front Square</title>
    <body>
        <img src"/home/frontsquare/frontsquare/media/images/trial.png" alt="trial">
    </body>
</html>

Even though we have trial.png present in the path: /home/frontsquare/frontsquare/media/images folder, the image is not rendered and displayed.

Kindly help us.

`FrontSquare Team

Have you tried a relative path to the image?

E.g. <img src"media/images/trial.png" alt="trial">

if the 'media' directory is a child of the directory where your HTML file is.

Relative paths also make testing easier, as the file set may then 'work' at a completely different location, e.g. other web site or on a PC.

hth Jim

Shouldn't that be src="?

Also, you can't use the real file path, you need to use the path relative to your static files mappings.

So, if your static file mapping is URL /media/ maps to path /home/frontsquare/frontsquare/media, then a file stored at /home/frontsquare/frontsquare/media/images/trial.png will have the URL /media/images/trial.png