Mailinglist Archive: opensuse (924 mails)

< Previous Next >
[opensuse] bash script to build html gallery
  • From: Eric Gunther <egunther@xxxxxxxxxxx>
  • Date: Thu, 04 Oct 2012 12:13:43 -0400
  • Message-id: <1349367223.3538.22.camel@linux-hq44>
Hello list,

I want to make a script which builds static html pages from a directory
of images.

8 images per page. Using tables. I was thinking that making the import
and convert part, in a separate script, using gphoto2 and Image Magick

The current script works with a template that is only the table row
(<tr> </tr>) definition.


for one in *.JPG; do

sed s/image/$one/g gallery.tmplt >> gallery.html




<a href="image"> <img src="small_image" alt="image"/></a>


What this yields is a page full of the name of the image as a link
to the large image. I assume this behavior with the "alt" field
being shown is because there is an underscore in the "img src" field.

So I would like to correct a few things:

+ have the template transcription stop at 8 images, to start a new page.

+ have the sed command able to interpret a template with multiple
image locations, so that I can have an entire web-page as a template
and not just the table row section (see below for clarification).

+ have the underscore behavior changed--- although I had this working so
this problem is minor.


The idea of the loop occurred to me because I have a list of images

"----for one in *.JPG; do--------"

from which I want to pluck images.

"--------sed s/image/$one/ gallery.tmplt >> gallery.html---"

So that when the script encounters the word (regex) it then replaces it
with the next in the list. Where I have the difficulty is when I have
multiple "image" instances in the page. I think I may be able to get the
desired behavior with another loop, which increments "n", something like

------sed /n/s/image/$one/ gallery.tmplt >> gallery.html

Because I would like to replace all occurrences on a line with the
current image. This would be useful for me to understand because I
think I could implement the same simple technique to count the images
per page.

Thanks for any help,


To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >