Mailinglist Archive: opensuse (924 mails)

< Previous Next >
Re: [opensuse] bash script to build html gallery
  • From: Eric Gunther <egunther@xxxxxxxxxxx>
  • Date: Thu, 04 Oct 2012 13:44:28 -0400
  • Message-id: <1349372668.3538.35.camel@linux-hq44>
on Thu, 2012-10-04 at 13:02 -0400, Ken Schneider - openSUSE wrote:
On 10/04/12 12:13, Eric Gunther pecked at the keyboard and wrote:
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,


Thanks, but that isn't what I am looking for... I have seen things that
I might use... for instance
or others on sourceforge or freshmeat but as I have previously
mentioned, I would like to be able to change it and fix it (in essence
'hack' it) to suit my needs.


Take a look at JAlbum, it may fulfill your needs without having to
re-invent the wheel.

Ken Schneider
SuSe since Version 5.2, June 1998

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

< Previous Next >
Follow Ups