Trouble locating images - php

I'm having trouble with missing images on my server.
I have been developing a site locally using MAMP for a while and now that I have uploaded it to my server the images cannot be found. Firebug tells me "Failed to load the given URL".
The file structure is the exact same as it was locally and the code is also the same.
The php file trying to load the images is in the site's root folder along with the folder "images".
Here is the file structure: images/models/dreadfinsl1.jpg
Here is the page: http://eoghanoloughlin.net/george/index.php
Can anyone help me? It seems like it would be just one of those stupid problems / simple answers but I'm relatively new to this don't have much experience. It was working fine when I was using MAMP.

Looks like your in the /george/ map on the server, and i assume locally u used www/
try /george/images/models/dreadfinsl1.jpg
else you will have to use full path http://eoghanoloughlin.net/george/images/models/dreadfinsl1.jpg

Try to access an image which is in your server with the help of web browser by specifying absolute path of the image....
Like http://eoghanoloughlin.net/images/models/dreadfinsl1.jpg
If you found any image on the browser, try to display the same image on your index page...
I think specifying the file path is being a problem in your application....

Related

PHP/HTML image not being sourced when running XAMPP Server

When using XAMPP, I am loading a page (index.php) and am using MySQL to get the directory of an image I want to use. This is a snippet of the code block that does this:
<img src="<?php echo $resource['main_image'];?>">
I know that the php code is working because when I inspect element the page on localhost, I get
<img src="assets/images/defaults/default_pic.png">
This image exists in the folder but just doesn't seem to load when the server is run. When I inspect element and click on Sources, the image folder is not sourced, but the css and js folders are:
As you can see, the assets/images folder is not loaded. I can't seem to find any way to load this folder. I have tried other solutions to similar problems, such as giving an absolute path to the image, and yet other folders a sourced and not this image folder. I have tried looking for ways to source images in the head of the HTML, and those don't exist either.
In addition, it seems that if I explicitly state the image location and not use a MySQL Query to locate it, it loads fine. It is only when I query the location does the image not load.
A workaround that worked for me is to create a new directory for pictures outside of assets, in the working directory of the current file. It is not ideal, but it is a workaround for the issue.

PHP - Can't display images from parent directories

I am working on a program that involves displaying images stored in a server.
My working directory is
~/public_html/lab5/
The images are uploaded successfully to the following directory:
~/public_html/lab5/uploads/
Images ARE NOT displayed when I try to display the images using the path
~/public_html/lab5/uploads/image.jpg
but they are displayed normally using the following path
uploads/image.jpg
I'm just wondering, what is wrong with the relative-to-home path that I'm using?
Thanks in advance,
Rafi
It would be hard to say for sure without any idea what your server looks like, but I'm guessing based on the paths you've listed that ~/public_html/lab5 is your document root, in which case, the webserver doesn't know about anything except the contents of lab5 and its sub-directories.

Getting a 404 on images uploaded using FTP in Magento

I have recently installed Magento and am using it for the first time. I am trying to uplaod an image to a folder as the new logo in the heading. When I upload the image using FTP the file uploads successfully but I can’t see it in the folder listing in a browser or on the website or if I visit the url for the image. I get a 404 page instead. Everything is getting cached I believe. I have turned off caching in the back end and cleaned out var/cache folder. This is a new one to me as I wouldn’t ahve thoughts ftp uploading an image would or could be cached? I can’t even change the header image on my website.
Im using the hellowired them as a starting point.
Cheers
Check the permissions on the Images and the directory it is in.
Can you verify that it is in the folder that you have uploaded it too?
Can you view it on server browsing the directories?
Finally check that you have type it correctly as Linux box's are CAPS sensitive, this could be why you can't see it also.
Looks like my host migrated my accounts to another server and I was actually updating the old hosting. Thanks for your help.

This path for a picture doesn't work

I'm building graphs using pChart in PHP. The case is that I have my picture in the right folder, I know it because if I put that path in the browser I can see my picture, but in the template, it doesn't show up. Firebug shows "failed to load the given URI".
<img src="/home/user1/mysite/Admin/Template/mx_graphs/example13.png">
The picture has all the rw permissions given, and the folder.
You appear to be using a UNIX file path instead of a relative URI. Your web server is unlikely to be configured to have the DocumentRoot be / (and it would be very silly to do so).
Construct a URI relative either to the HTML document or to the DocumentRoot of your server.
The latter will probably be /Admin/Template/mx_graphs/example13.png
Remember the statement:
<img src="/home/user1/mysite/Admin/Template/mx_graphs/example13.png">
Will run on the client side, so if you run this on the very computer where the picture is stored, it should work fine, but if you try to open it from another computer it will not work.
Try to use relative path (http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/), and try to keep the website resources into the website root folder, so that even when you host the site the image be copied over and will still be accessible..

php page image links not working with MAMP

I'm running a php website locally using mamp. On the front page (i.e. index.php) there are a few broken image links that point to image files like '/images/logo.gif'. These were working on a version of the site hosted remotely.
In the actual main web folder I see a subfolder "resources" that contains the subfolder "images". I can't figure out whether the image links should know to look in the resources folder from other code or if the img src field in the html (from inspect element on the locally hosted version) should actually be reading 'resources/images/logo.gif'. I'm hesitant to just change the field in the code without knowing if it should be seeing the subfolder in resources.
EX.
-/site
-index.php
-/includes
-/resources
...
-/images
-logo.gif
...
-/css
etc....
I apologize for this novice question, but I just can't figure out the appropriate resources to find the right answer for this.
If your image links to "images/logo.gif" then your browser will look for the images folder in your root directory. The reason that you're getting broken image links is because you don't actually have an images folder there! You'll need to change everything to "resources/images/logo.gif".
Okay, so it looks like on the remote site there were actually two separate images folders, one at the root level, and one in the resources folder. That would explain my confusion.

Categories