-1
<!DOCTYPE html>
<html>
<head>
    <title>This is Hello World page</title>

</head>
<body>
    <h1>Hello World</h1>
    <img src= "<?php echo __DIR__ .'/pic.png' ?>"> 
</body>
</html>

I can't figure out why the code isn't showing the image. I made sure to name the file with a .php extension and to put both files in the same folder (the desktop).

The eventual goal is to upload an entire folder to a server. Within that folder, there will be an index.php file and an image. How can I point the file to the image?

whatwhatwhat
  • 1,991
  • 4
  • 31
  • 50

1 Answers1

2

If pic.png is in the same directory, this will work.

<img src="pic.png">

Also, move the img tag into the body.

user2182349
  • 9,569
  • 3
  • 29
  • 41