LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   load photos in webpage (https://www.linuxquestions.org/questions/linux-newbie-8/load-photos-in-webpage-4175507481/)

Pedroski 06-09-2014 07:24 AM

load photos in webpage
 
I made a simple webpage for a girlfriend, published it by hostica.com

At home I put all 4 photos in a folder called fotos. I uploaded everything with Filezilla.

When I opened the page, the photos would not load. After I moved all the photos to a folder called images, which was already there,they loaded ok. In my files they were referenced as

Code:

<img src="fotos/headandshoulders.jpg" />
This worked fine at home.

I changed that to:

Code:

<img src="images/headandshoulders.jpg" />
This works on the net.

Why is that?

rtmistler 06-09-2014 12:45 PM

This maybe should go into a different forum, such as Programming.

The standard directory to place images within in an HTML page is images. In fact, you do not need the text "http://www.linuxquestions.org/questions/images/" before each filename in the src= parts of the attribute.
Code:

<img src="headandshoulders.jpg" />
will work fine. Yes it does seem counter-intuitive in that it appears legal to use your first notation because you selected a sub-directory called "fotos"; however I've not had success using alternate sub-directory names either, I've always had to use "images".

I'm sure there are more detailed references, this is just a known thing to me but I searched a little for a reference that explains this http://www.htmlgoodies.com/primers/h...le.php/3478181 in the paragraph where it says "Placing An Image On Your Page".

Also, since I learned HTML by the seat of my pants and not via formal training, my answer is colored by trial and error based experience versus some substantive knowledge of the development of the language.

Philip Lacroix 06-09-2014 04:29 PM

Hi,

since you mention that a directory called "images/" was already there in your web space, maybe your hosting provider is expecting you to use it, and doesn't allow to override it. On the other hand, you might want to check the settings of your hosting account: perhaps the "images/" directory is defined somewhere and can be overridden by the user. I assume that your custom "fotos/" directory is at the same level as "images/", and that permissions are set correctly.

That said, I never had problems like this, either on my local server (Apache) or on the remote hosting space (Apache as well): I can use the names I want, and put directories and files wherever I want. However, if yours is a cheap hosting service then you might have some restrictions.

Regards,
Philip


All times are GMT -5. The time now is 05:50 AM.