Right now my file structure looks like this:
root
/images
/banner.png
/dir
/file.php
/index.php
I'm working in file.php
. I'm trying to access banner.png
, and so far I have this:
<?php echo dirname( dirname(__FILE__) ) . '/' . $recent1["Image"];?>
Where $recent1["Image"]
is images/banner.jpg
.
When I echo the code as plain text, this path shows up:
/home/htdocs/images/banner.png
Which I feel like is right, but I'm not sure if it's the exact same thing as
(root)/images/banner.png
Again, I feel like those two are the same thing, but the image isn't displaying when I put that code I showed above in for the src
attr for an img
tag. It shows that broken picture icon thing. Yes, I'm sure that images/banner.png
exists. Thanks for the help in advance.
Edit: I also might add that in index.php
, using just $recent1["Image"]
does indeed display the image.