Reputation: 21
I'm trying to echo out an image in a PHP function using 'img src', but I can't get it to work. The function itself works fine, everything else that I return or echo is working.
The image is located 1 folder 'back / up', then into the folder 'images' and the name of the image I'd like to acces in the 'images' folder is 'nike1.jpg'.
The following code isn't working:
echo '<img src="../images/nike1.jpg">';
No idea what I'm doing wrong here. Thanks in advance!
Upvotes: 2
Views: 3303
Reputation: 345
Its because your image files don't have proper read permission, make sure those image files are readable.If you are an Linux user type the bellow command which will provide all access to the file.
First go to the image file directory in terminal and type the following.
sudo chmod 777 *
Upvotes: 1
Reputation: 21
Not a real answer, but I decided to upload the image(s) on imgur and just use the image URL. Thanks for all the support.
Upvotes: 0
Reputation: 2991
You need to check your path. I am little confused that you have "back" and "up" as two different folders or its one folder. It should be like "/your_parent_directory/back/up/images/nike1.jpg" or you can also write as "../back/up/images/nike1.jpg" if back and up are two folders. Can you tell the full path of the image.
Upvotes: 0