Forum Moderators: open

Message Too Old, No Replies

Where to store images for website?

         

Digmen1

8:58 pm on Dec 24, 2024 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hello
What is the latest trend for storing images for your website?
In the main folder or in a sub folder just for images?

tangor

8:01 am on Dec 25, 2024 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Put them where they make the most sense to YOU since you are the one managing them.

That said, I personally have several folders dedicated to image-only storage to keep the content together in a relative sense.

engine

11:45 am on Dec 25, 2024 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Yes, keep it logical: That way you can locate and change an image easily. In addition, you can easily block bad bots, and change the structure should you need to. Only distribute images throughout if your menu structure is logical.

not2easy

11:55 am on Dec 25, 2024 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



That might depend on the nature of the images. If they are your own work (art or photography), it might be better to use a separate folder so you could limit access to them to your own site.

Digmen1

9:06 pm on Dec 28, 2024 (gmt 0)

10+ Year Member Top Contributors Of The Month



I am thinking of putting all of my images in one sub folder.
That way, in my main folder I will only have html files
It is more work and more coding

But what is the trend?
What do most webmasters do?

not2easy

9:20 pm on Dec 28, 2024 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Most of the sites that put their images in a separate folder are WordPress sites, but not because it is a trend, it is how WP works, so they do it that way. It isn't a choice for them.

Others manage images in the way they prefer.

lucy24

11:33 pm on Dec 28, 2024 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I hope nobody has been telling you that the exact URLpath of your images is a significant SEO factor. They just say it to scare you.

Do you need examples? On my main site, I have any number of directories called /images/. The repeated name doesn’t matter, just like it doesn't matter if you have a bunch of files all named index.html, because none of them are visible URLs. Each one contains the images associated with the directory that its HTML pages are located in. So you’ll find

example.com/images/ (images used by the site root)
example.com/ebooks/images/ (images used by /ebooks/ index page, and by any pages lying loose in /ebooks/)
example.com/ebooks/title1/images/ (images used by title1, which consists of one or more html pages)
example.com/ebooks/title2/images/ (images used by title2)
example.com/ebooks/title3/images/ (images used by title3)

graeme_p

6:39 pm on Dec 29, 2024 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think people are right in saying you should do what makes sense.

A lot of software has a way of doing it, so you should follow what you CMS or framework favours. For example, I mostly build sites with Django, which encourages you to use one directory for static files (part of the site - e.g. logos and the like) and another for uploaded images. Both can (usually should) have subdirectories for different parts of the system so i call the first "static" and the second "media" or similar. it is also easy to configure the webserver to serve these directly and pass other urls to the application.

"But what is the trend?
What do most webmasters do?"

Why does "the trend" matter? I have no idea what the trend is and do not care. Its probably to do something that people have forgotten is a bad idea - the latest trend usually is.

What most people do will do whatever their CMS does.

cooler29

7:29 pm on Dec 31, 2024 (gmt 0)

10+ Year Member Top Contributors Of The Month



Digmen1: depends of What You want?

I will NOT talk about SEo since it seems that SEO is dead those days so I will talk about speed:

it is best to store at subdomain. For example your domain is "Digmen1", and "images.Digmen1" would be fine.
Also even better is to use 3rd parity (free) service for cloud image hosting.

Reson is simple: speed. On that way no matter is on Your own subdomain image located or 3rd parity could service image loas asyhronic that speed up web page load.

Digmen1

9:53 pm on Dec 31, 2024 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks for all the advice and comments.
As a self taught coder, I asked what is the trend I should have asked what is the best practice.

I would like to put all my images into a sub folder so that they do not clutter up my main folder where I store my html pages.
But the downside is that there is much more coding to do, and uploading the images from my desktop to my webhost is a few more steps for each image

lucy24

10:45 pm on Dec 31, 2024 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



there is much more coding to do
If you don’t already have a text editor that does multi-file global replace, this is the time to get one. Any place in your html that currently says
img src = "/picture.jpg"
can be changed in one fell swoop to
img src = "/images/picture.jpg"

And then, if all your images are in a single directory, you can then upload that directory all at once. For that matter, you could also do it if the images are lying loose. If your current ftp-or-similar won't let you do it in a batch, it's time to look for different software. (I’ve used Fetch forever, except for one glitch when they couldn't do SFTP, now long since cured. There are plenty of choices.)

graeme_p

6:06 pm on Jan 2, 2025 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Unless you site is very small I would suggest not manually editing all your HTML. Static site builders are quite nice these days. I am sure people will disagree with me.

I also use rsync over ssh instead of sftp. Faster and means it ensures you have synced everything in one go.

Digmen1

7:16 am on Jan 5, 2025 (gmt 0)

10+ Year Member Top Contributors Of The Month



I use Sublime text editor
and sometimes
Visual Studio Code

Do these programs have that multi file global replace?

lucy24

6:32 pm on Jan 5, 2025 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don’t know, do they?

I use SubEthaEdit (which doesn’t) and BBEdit (which does).

Mark_A

2:52 pm on Jan 8, 2025 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Early websites I kept images in the directory of the pages they were used in.

Later I made a www.domain.com/images/ directory and put everything in there. It makes sense to have all your jpgs in one place and then you can also have all your html files in another place also.

thecoalman

1:27 pm on Jan 15, 2025 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I use Notepad++, the search has 5 tabs for different features. For find in files tab you can point it at single directory or include all sub directories. You can use regex for your find and replace so if you were using lucy's example from above you can use regex for the filename. With the regex you can also do other cool stuff like start of line or end of line. It also has a filter for directories and files if you want to ignore them.

One thing to remember about find and replace is finding "cat" and replacing it with "dog" turns catastrophe into dogastrophe. You need to be more specific, Find " cat " and replace with " dog ". Of course that doesn't find " cat." Oh the joys of find and replace. :)

lucy24

6:23 pm on Jan 15, 2025 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Or, better, \bcat(s)?\b >> dog\1 (or dog$1 as the case may be)

But that’s a different thread ;)