Djokito Djokito - 4 months ago 13
HTML Question

Create a HTML page displaying GIFs with a Batch File

I need to display a lot of GIF pictures in one place, and being able to add some whenever I want.
The solution I have found is to create a batch file which creates an HTML page displaying the GIF. But I'm a beginner with CMD language and after some research here is what I have written :

FOR /F %%G IN ('dir /B *.gif') DO echo ^<img src="%%G"^>^ ^<br^>^<br^>^<br^> >> gifs.html


It works but it is really simple, and I don't seem to be able to add page settings and layout (such as center the GIFs, maybe add a background etc...) automatically from the Batch. I can't find anything on the web as to how to do that. Can someone put me on the rails here ?

Thanks very much !!

Djokito

cdm cdm
Answer

you can create separate static CSS file (named e.g.: your.css) in the same folder containing something like:

body{
  text-align: center;
  background-color: #aaaaaa;
}

img{
  width: 300px;
}

and then add this line to the beginning of your batch file:

echo ^<link type="text/css" href="your.css"^> >> gifs.html