4 Replies - 496 Views - Last Post: 15 January 2015 - 04:10 AM

#1 joanne870   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 07-January 15

Images not being displayed in php website

Posted 14 January 2015 - 04:38 PM

I am trying to create a profile picture but the image is not being displayed on my website this is the code I am using:

echo "<img width='100' height='100' src='http://localhost/blog/pictures/default.jpg' alt='Default Profile Picture'>";


and they are appearing like this:

Does anyone now how I can fix this please?

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: Images not being displayed in php website

#2 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12657
  • View blog
  • Posts: 45,831
  • Joined: 27-December 08

Re: Images not being displayed in php website

Posted 14 January 2015 - 04:40 PM

Moved to HTML/CSS. This is not a PHP issue.

I would use relative paths rather than absolute paths. Note that localhost means your local machine.
Was This Post Helpful? 0
  • +
  • -

#3 joanne870   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 07-January 15

Re: Images not being displayed in php website

Posted 14 January 2015 - 04:45 PM

I'm sorry I didn't quite understand you. Can you show me an example please

This post has been edited by Dormilich: 15 January 2015 - 01:35 AM

Was This Post Helpful? 0
  • +
  • -

#4 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6824
  • View blog
  • Posts: 31,470
  • Joined: 10-May 07

Re: Images not being displayed in php website

Posted 14 January 2015 - 04:51 PM

Relative root path would mean not using the protocol or the url as the source & relative to where the file is.

<img src='images/file.jpg'>

Was This Post Helpful? 0
  • +
  • -

#5 joanne870   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 07-January 15

Re: Images not being displayed in php website

Posted 15 January 2015 - 04:10 AM

Ok thanks so much. Fixed the problem :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1