Reputation: 147
I am learning PHP by myself for doing my final year project, but I cant figure it out how to display images on my website if the image is in my ftp. I know how to do in html using local host, but I dont know how to do it on my specific remote host.
I am currently using the code:
echo '<img src="'.public_html/logo.gif.'" style=width:"' . 300 . 'px;height:' . 280 . 'px;">';
If I right click on the image on my directory and select copy url it gives me:
ftp://[email protected]/public_html/logo.gif
but if I put all of that it still doesnt work. I am using lunar pages host recommended by w3schools.
If someone has any idea of how to fix my problem, please reply. I read some tutorials, my image display incorrectly. The website I started to develop is smartdatabasesystem.com
Thank you :-)
Upvotes: 0
Views: 168
Reputation: 14499
Your FTP host and HTTP host are the same machine (both "local"), but the FTP root directory (and protocol - ftp://
, obviously) are different. Your http root directory is INSIDE your public_html
directory, so your logo is available at:
http://smartdatabasesystem.com/logo.gif
Basically, for your server set up (this will be different on different servers), you can presume that any time you have an FTP location of ftp://[email protected]/public_html/[SOMETHING]
, the resource will be available at http://smartdatabasesystem.com/[SOMETHING]
. If the file is below the /public_html/
directory, then the resource will not be available to the outside world through HTTP.
Also, Lunar pages is a fine host, but you might catch some flack for taking any suggestions from w3chools... they're not exactly well respected by more senior developers :)
Upvotes: 2