From egunther@warwick.net Thu Oct 4 16:14:05 2012 From: Eric Gunther To: users@lists.opensuse.org Subject: [opensuse] bash script to build html gallery Date: Thu, 04 Oct 2012 12:13:43 -0400 Message-ID: <1349367223.3538.22.camel@linux-hq44> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2234389456202128939==" --===============2234389456202128939== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 respectively. The current script works with a template that is only the table row ( ) definition. *script* for one in *.JPG; do sed s/image/$one/g gallery.tmplt >> gallery.html done *template* image 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. :clarification: 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 this; ------n=0 ------n=n+1 ------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, -e -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============2234389456202128939==-- From per@computer.org Thu Oct 4 16:26:39 2012 From: Per Jessen To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Thu, 04 Oct 2012 18:26:21 +0200 Message-ID: In-Reply-To: <1349367223.3538.22.camel@linux-hq44> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2671824558500311155==" --===============2671824558500311155== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Eric Gunther wrote: > > image > > > 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. The contents of the "alt" attribute is shown when the image cannot be found. [snip] > Thanks for any help, > Eric, it's a fairly simple programming problem you got here, whether you do it in bash, simula2 or lisp. There are plenty of people here who can whip up a script for you in no time, but is that what you really want? It might better with soe more specific questions. -- Per Jessen, Zürich (16.4°C) -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============2671824558500311155==-- From suse-list3@bout-tyme.net Thu Oct 4 17:02:56 2012 From: Ken Schneider - openSUSE To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Thu, 04 Oct 2012 13:02:49 -0400 Message-ID: <506DC139.2020708@bout-tyme.net> In-Reply-To: <1349367223.3538.22.camel@linux-hq44> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4183614710640376535==" --===============4183614710640376535== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 > respectively. > > The current script works with a template that is only the table row > ( ) definition. > > > *script* > > for one in *.JPG; do > > sed s/image/$one/g gallery.tmplt >> gallery.html > > done > > > *template* > > > > image > > > > > > 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. > > > > :clarification: > > 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 > this; > > ------n=0 > ------n=n+1 > ------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, > > -e > Take a look at JAlbum, it may fulfill your needs without having to re-invent the wheel. http://jalbum.net/en/software/download -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============4183614710640376535==-- From egunther@warwick.net Thu Oct 4 17:40:47 2012 From: Eric Gunther To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Thu, 04 Oct 2012 13:40:21 -0400 Message-ID: <1349372421.3538.32.camel@linux-hq44> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7549679527339568212==" --===============7549679527339568212== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Thu, 2012-10-04 at 18:26 +0200, Per Jessen wrote: > Eric Gunther wrote: > > > > > image > > > > > > 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. > > The contents of the "alt" attribute is shown when the image cannot be > found. Yes, and the reason the image is not found is because the path is wrong... the reason the path is wrong is because "small_image" was not replaced. > [snip] > > Thanks for any help, > > > > Eric, it's a fairly simple programming problem you got here, whether you > do it in bash, simula2 or lisp. There are plenty of people here who > can whip up a script for you in no time, but is that what you really > want? It might better with soe more specific questions. I appreciate that, and also I appreciate the frank response. But in reality I actually just want to get to the html page, then the upload and convert script, and then move on to better things. You see, I take nice pictures and I am sort of artistically inclined so I: 1.) Have trouble parsing the man pages and associated information. I have, in fact, spent hours trying to get this idea to work, with sed, and have gotten starts and stops but no success. 2.) Would like a simple stable script with which to display them, preferably one which I have written so that I can fix it or change it as the demand changes. I have seen other things in the man pages about prompting and things of an interactive nature that I may put in later in sooner but that is not what I am working on. I feel somewhat exposed but, that's more or less it, thanks, -e > > > -- > Per Jessen, Zürich (16.4°C) > -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============7549679527339568212==-- From egunther@warwick.net Thu Oct 4 17:44:49 2012 From: Eric Gunther To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Thu, 04 Oct 2012 13:44:28 -0400 Message-ID: <1349372668.3538.35.camel@linux-hq44> In-Reply-To: <506DC139.2020708@bout-tyme.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8662158826392023477==" --===============8662158826392023477== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 > > respectively. > > > > The current script works with a template that is only the table row > > ( ) definition. > > > > > > *script* > > > > for one in *.JPG; do > > > > sed s/image/$one/g gallery.tmplt >> gallery.html > > > > done > > > > > > *template* > > > > > > > > image > > > > > > > > > > > > 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. > > > > > > > > :clarification: > > > > 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 > > this; > > > > ------n=0 > > ------n=n+1 > > ------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, > > > > -e > > Thanks, but that isn't what I am looking for... I have seen things that I might use... for instance http://www.smugmug.com/ 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. -e > Take a look at JAlbum, it may fulfill your needs without having to > re-invent the wheel. > > http://jalbum.net/en/software/download > > -- > Ken Schneider > SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============8662158826392023477==-- From michael@actrix.gen.nz Thu Oct 4 23:23:31 2012 From: michael@actrix.gen.nz To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Fri, 05 Oct 2012 12:23:11 +1300 Message-ID: <201210051223.11210.michael@actrix.gen.nz> In-Reply-To: <1349372668.3538.35.camel@linux-hq44> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6052473135971304980==" --===============6052473135971304980== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Fri, 05 Oct 2012 06:44:28 Eric Gunther wrote: > mentioned, I would like to be able to change it and fix it (in essence > 'hack' it) to suit my needs. > The answer may be just to google around until you find examples you can template and adapt - there are lots of examples out there. On a similar search I found http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/ plus http://fancybox.net/ These examples embed javascript in their pages so that you can do transition effects, popups and slideshows. Your requirements seem a little different than mine, so these two may not suit, but there are lots of examples out there. -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============6052473135971304980==-- From egunther@warwick.net Thu Oct 4 23:47:29 2012 From: Eric Gunther To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Thu, 04 Oct 2012 19:47:08 -0400 Message-ID: <1349394428.8536.5.camel@linux-hq44> In-Reply-To: <201210051223.11210.michael@actrix.gen.nz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1741659643438963565==" --===============1741659643438963565== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hi, Certainly, thank you for responding but no, not what I am looking for. I have looked around quite a bit, found numerous references. For instance searching for "bash script" is useful. Likewise, searching for "bash script html" comes up with useful info. thanks, -e On Fri, 2012-10-05 at 12:23 +1300, michael(a)actrix.gen.nz wrote: > On Fri, 05 Oct 2012 06:44:28 Eric Gunther wrote: > > mentioned, I would like to be able to change it and fix it (in essence > > 'hack' it) to suit my needs. > > > > The answer may be just to google around until you find examples > you can template and adapt - there are lots of examples out there. > > On a similar search I found > > http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/ > > plus > > http://fancybox.net/ > > These examples embed javascript in their pages so that you can > do transition effects, popups and slideshows. Your requirements > seem a little different than mine, so these two may not suit, but > there are lots of examples out there. -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============1741659643438963565==-- From per@computer.org Fri Oct 5 06:14:04 2012 From: Per Jessen To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Fri, 05 Oct 2012 08:13:45 +0200 Message-ID: In-Reply-To: <1349372421.3538.32.camel@linux-hq44> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9163105555265439160==" --===============9163105555265439160== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Eric Gunther wrote: >> [snip] >> > Thanks for any help, >> > >> >> Eric, it's a fairly simple programming problem you got here, whether >> you do it in bash, simula2 or lisp. There are plenty of people here >> who can whip up a script for you in no time, but is that what you >> really want? It might better with soe more specific questions. > > I appreciate that, and also I appreciate the frank response. But in > reality I actually just want to get to the html page, then the upload > and convert script, and then move on to better things. Here is something to work on: ---------- #!/bin/sh dir= perpage=8 page=0 find $dir -type f |\ while read image do page=$(expr $page + 1) printf "%s page %u" $dir $page n=$perpage while test $n -gt 0 do thumb="thumbnails/"$(basename $image) convert $image -scale 256x192 $thumb printf "\n" $image $thumb n=$(expr $n - 1) test $n -gt 0 && read image done printf "\n" done --------- It's not perfect, plenty of room for optimization. You'll need to manually separate the pages and write some CSS for the formatting. -- Per Jessen, Zürich (11.8°C) -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============9163105555265439160==-- From egunther@warwick.net Fri Oct 5 07:44:39 2012 From: Eric Gunther To: users@lists.opensuse.org Subject: Re: [opensuse] bash script to build html gallery Date: Fri, 05 Oct 2012 03:44:17 -0400 Message-ID: <1349423057.4235.0.camel@linux-hq44> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5474514346464698775==" --===============5474514346464698775== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Thank You kindly, -e On Fri, 2012-10-05 at 08:13 +0200, Per Jessen wrote: > Eric Gunther wrote: > > >> [snip] > >> > Thanks for any help, > >> > > >> > >> Eric, it's a fairly simple programming problem you got here, whether > >> you do it in bash, simula2 or lisp. There are plenty of people here > >> who can whip up a script for you in no time, but is that what you > >> really want? It might better with soe more specific questions. > > > > I appreciate that, and also I appreciate the frank response. But in > > reality I actually just want to get to the html page, then the upload > > and convert script, and then move on to better things. > > Here is something to work on: > > ---------- > #!/bin/sh > dir= > perpage=8 > page=0 > find $dir -type f |\ > while read image > do > page=$(expr $page + 1) > printf "%s page %u" $dir $page > > n=$perpage > while test $n -gt 0 > do > thumb="thumbnails/"$(basename $image) > convert $image -scale 256x192 $thumb > printf "\n" $image $thumb > n=$(expr $n - 1) > test $n -gt 0 && read image > done > > printf "\n" > > done > --------- > > It's not perfect, plenty of room for optimization. You'll need to > manually separate the pages and write some CSS for the formatting. > > > > -- > Per Jessen, Zürich (11.8°C) > -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org To contact the owner, e-mail: opensuse+owner(a)opensuse.org --===============5474514346464698775==--