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.
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" ?
The php code is in the first_folder and the image.jpg is in the third_folder.
why not like this
Why would you want to add '../' ? Do you know what that means?
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.
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)
Hi cups, Thank you for enlighten my mind...it helps me.
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' />";
Hi,Thank you so much for this,and for helping me...I give a try on this.
This topic is now closed. New replies are no longer allowed.