I would like to create an .html file with all the pictures that are in a folder. I am not really used to programming, so I would like a solution quite simple, without having to get specific programs to code in JS or PHP.
I found the perfect solution on a topic on this website, but I would like to add some extra-features and I don't know how. This is the method I found witten by Marged : Put all images from directory into HTML
If the list of files is static (you didn't mention if they are created dynamically or not) and you are using Windows a simple approach like this will do:
for %i in (*.jpg) do echo ^<img src="%i" /^> >> all.html
This will create a all.html file which includes references to your jpgs. Simply run the command from a command line window in the directory where your images are stored.
It works great, there is one major improvement I would like to add and I would need your help for that :
- Right now, it finds all the pictures in the main folder. I would like it to look for all the pictures in every sub-folders and sub-sub-folder of this main folder. Is that possible ?
There are also two little things that bother me but not of great importance :
I changed the code so it also looks for .png files :
for %i in (*.jpg *.png) do echo ^<img src="%i" /^> >> all.html
. It sorts pictures in alphabetical order, but firts all the jpg and then all the png, is it possible to "mix" them together ?Is it also possible to add a random way of sorting the pictures ?
Thanks a lot for your answers :)