I prefer to think of images as standalone assets that are included in zero or more pages. In most cases, my images appear on one page. There are times when I want to have them on several pages, and in other cases I donโt snap the image at all. If your workflow is to put each image in a directory with a message, searching for them begins to require a significant amount of search, and you need to come up with something else for images that do not belong to a particular message.
The approach that I use is on the opposite side of the spectrum. I have one image directory (from "/ images") and 100% of my images are placed there. The advantages of this:
When I add an image to a message, itโs easy for you to know which way to use. It is always:
/images/{image-name}
For example: http://alanwsmith.com/i/aws-20111017-0906-02 . This allows you to write a plugin, so all you need to enter is the name of the image, and the rest of the known path will be automatically populated.
With an application like Photo Mechanic , it's incredibly easy to browse through the local directory and see each image. If I want to include an image on another page, this will significantly reduce the time it takes to search.
There is no separate location / process if I want to send an image to someone without actually including it on the page (i.e. send them a direct link to the image file). I just drop the image into the standard directory and send a direct link.
If you want to get a little more advanced, saving all your images in one directory can also make some interesting settings. For example, even if the URLs for my images start with "/ images", the images are actually stored in a directory outside of those used by jekyll. In my case, the top of my source tree is as follows:
./html ./source-files ./image-files
All my images are stored in the "./image-files" directory. In my apache configuration, I configured an alias so that the url / image points to the "./image-files" directory. For example:
Alias /images /webroot/image-files
When I run jekyll, it processes everything in "./source-files" and transfers it to "./html". Since all images are outside of these two directories, jekyll never sees / touches them. As your image library grows, this will speed up the process and prevent a huge amount of unnecessary file copying.
Another tweak that I love about Apache is turning on:
Options +MultiViews
This allows you to call your images without using a file extension (for example, "no" .jpg ",". Png ", etc.). You can see this in the link above link. For performance it does not really matter. To me I just like the way it looks, and it saves me having to enter an extension every time I call the image.
MultiViews also allows you to replace an image in one format with another without having to re-encode anything else. For example, if you delete "some-image.gif" and replace it with "some-image.png", you do not need to touch any HTML. He will still be given the form "/ images / some-image". The need for such changes is probably extremely rare. I just find it interesting.
Finally, you can make one decision about whether to allow or disallow viewing the image catalog. Personally, I want my images to appear where I place them. So, I installed the .htaccess file in my images directory:
Options -Indexes
If you intend to work on a site with many thousands or tens of thousands of pages and images, this may not scale. For a regular personal site, I believe that this approach simplifies working with images.