Preet Saxena
Preet Saxena

Reputation: 127

I am using html tag but the image is not displaying

<img src="D:/xampp/htdocs/image_app/images/cardekho-pdf-logo.png" width="400" height="400">

I am using following code but the image is not displaying. Please tell me what wrong with source code

Upvotes: 1

Views: 93

Answers (6)

hemnath mouli
hemnath mouli

Reputation: 2755

Buddy.? If u are using XAMPP why don't you try like

http://localhost/images/cardekho-pdf-logo.png

instead of

D:/xampp/htdocs/image_app/images/cardekho-pdf-logo.png

Try like

<img src="http://localhost/images/cardekho-pdf-logo.png" width="400" height="400" alt="pdf-logo">

Upvotes: 1

Pkarls
Pkarls

Reputation: 33

<img src="D:/xampp/htdocs/image_app/images/cardekho-pdf-logo.png" width="400" height="400" />
  1. Do you have a closing tag? I added a slash so the tag is self-closing (so you don't need a seperate closing tag).
  2. If possible, move the image to a folder inside the project like this

/root_project_folder/images

Doing this will allow you to use a relative path instead of a absolute path.

Upvotes: 0

Babajide Apata
Babajide Apata

Reputation: 693

These are likely cause of the image not displaying

  1. Ensure that the image is in the folder (in your own case images)
  2. if the image exist in the folder, Ensure that the extension of the image is the same as what you specified, in you own case its png.
  3. Also the folder is in your project folder

Upvotes: 0

Vhortex
Vhortex

Reputation: 381

You are using an image link on your local computer, if people will view your website.. the browser will try to locate the image on your visitors local computer.

Example. Juan create an image link pointing to his D: drive and uploaded the html to the internet. Juan can see the image since it is on his D: drive but Pedro can't see it. Pedro may even have no D: drive and if he have, the file cardekho-pdf-logo.png wont be even there.

To fix your issue since you are running XAMP. Load it from root folder or from HTDOCS

<img src="/image_app/images/cardekho-pdf-logo.png" width="400" height="400">

Upvotes: 0

Ivin Raj
Ivin Raj

Reputation: 3429

try this one:

<img src="../xampp/htdocs/image_app/images/cardekho-pdf-logo.png" width="400" height="400" alt="pdf-logo">

Upvotes: 0

Gwendal
Gwendal

Reputation: 1273

This is a windows link. Try hosting your image online, or use file://D:/xampp/htdocs/image_app/images/cardekho-pdf-logo.png but it'll be only available for you

Upvotes: 0

Related Questions