How to set absolute path for img attribute in html

Viewed 41

sorry for this dummy question but i am having a trouble in my django and react app. i have an endpoint which serves the image name but the image is saved in my local directory and in my react app i just want to append the file name like this
function Condition(props) { let src = C:/Users/25191/Desktop/python_projects/doctorsolve/Drsove/media/media/images/HealthCondition/${props.meddata.image}

return (
    <>
        <div className="item">
            <a href="#">
                <img src={src} alt="medicine item image" />
                <div className="desc">
                    <p className="medicinename">{props.meddata.title}</p>
                </div>
            </a>
        </div>
    </>
);

}

2 Answers

If the question is how to refer to a local file, then use the file URI:

file:///C:/Users/25191/Desktop/python_projects/doctorsolve/Drsove/media/media/images/HealthCondition/${props.meddata.image}

Try:

 <img src="" alt="description"> 
Related