jemz — 2012-06-19T09:06:49-04:00 — #1
I need some help about the path i don't know how can i access this in php
this is the path c:\wamp\www\first_folder\second_folder\ hird_folder\image.jpg
but i could not display the image...what is the correct way in accessing my image thank you in advance.
guido2004 — 2012-06-19T09:09:08-04:00 — #2
It depends where the code is relative to the image. In what folder is the code file stored that contains src="../third_folder/image.jpg" ?
jemz — 2012-06-19T09:11:27-04:00 — #3
The php code is in the first_folder and the image.jpg is in the third_folder.
guido2004 — 2012-06-19T09:24:27-04:00 — #4
jemz — 2012-06-19T11:21:34-04:00 — #5
why not like this
guido2004 — 2012-06-19T11:57:00-04:00 — #6
Why would you want to add '../' ? Do you know what that means?
jemz — 2012-06-20T13:05:24-04:00 — #7
Hi, sorry for the late reply,to be honest i don't know what this means "../",can you please enlighten my mind on what it means.
By the way it's working i tried your solution thank you so much for helping me.
cups — 2012-06-20T14:40:11-04:00 — #8
If this is the real path of your files...
And the home page of your website is served from :
Then your html should reference it from that home page by adding a slash before the path of the requested file :
<img src = "/fiirst_folder/second_folder/third_folder/image.jpg" />
Then it matters naught where the webpage is served from on that website.
You need to read up on the difference between relative and absolute path.
../ means go up one directory from where I am now.
../images means go up one directory from where I am now, then go down into a directory called images
These are relative links (relative to where I am now)
jemz — 2012-06-20T22:51:55-04:00 — #9
Hi cups, Thank you for enlighten my mind...it helps me.
john_betong — 2012-06-21T05:47:35-04:00 — #10
I have struggled with paths and now define all paths in a constant.php. The file is then included:
define('LOCALHOST', in_array($_SERVER['SERVER_NAME'], array('localhost', '127.0.0.1') ));
$tmp = "c:\\wamp\\www\\first_folder\\second_folder\ hird_folder\\";
define('THUMB_PATH', substr($tmp,2) );
define('THUMB_PATH', "/home/content/42/558877/html/ci_john/subdomain/thumb/');" );
usage: - works both for LOCALHOST and Online
echo "<img src='" .THUMB_URL ."image.jpg' style='border:0' alt='whatever' />";
jemz — 2012-06-21T11:20:16-04:00 — #11
Hi,Thank you so much for this,and for helping me...I give a try on this.