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://smart206@smartdatabasesystem.com/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 🙂
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 yourpublic_htmldirectory, 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://smart206@smartdatabasesystem.com/public_html/[SOMETHING], the resource will be available athttp://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 🙂