HTML Image directory creation

ZIYAD A. M. AL-BATLY zamb at spymac.com
Mon Mar 28 01:38:35 UTC 2005


On Mon, 2005-03-28 at 09:15 +1000, russell cook wrote:
> Hi, 
> I've  been using igal to create html thumbnail/image catalogs for my
> web site and while very good it lacks a couple of features.
> 
> It's not recursive and even with the script below, doesn't handle
> directories which are a placeholder for other directories. i.e. a
> directory 2005 is just a placeholder for all picture directories I
> wish to create of events in 2005. hmmm this may not make sense here's
> an example:
> ./2004/Annalisa:
> ./2004/Braidwood:
> ./2004/CoffsHarbour:
> ./2004/EasterHunt:
> In the above there are no files in directory 2004 only the other
> directory entries. Each of the other directories has the  image files
> relevant to that event and needs to be catalogued.
> 
> 
> Here's the script I've been using to run igal. 
> #!/bin/sh
> DIR=/home/www/html/pics
> cd $DIR
> 
> FILE=DIRLIST
> ls -Rb1 >$FILE
> 
> while read LINE
> do 
>          if [ -d "$LINE" ] ; then
>                 cd "$LINE"
>                 echo Creating pictures in directory: "$LINE"
> #                pwd
>                 igal -a -f -wx 960 --bigy 450 -w 7 --www --title
> "$LINE"
>                 cd ..
>         fi      
> done < "$FILE"
> 
> This works on the first level of directory but doesn't truly recurse.
> The file DIRLIST has the information but it seems the line, "if [ -d
> "$LINE" ] ; then" is stripping the directory entry back to the last
> part of the path. i.e. DIRLIST shows ./2004/Braidwood: but $LINE only
> reports Braidwood. 
> 
> So my script skills are not up to the task, and I'm not sure igal is
> either (for what I want to do).
> 
> Any suggestions on 
>     a) how to make igal  truly recursive 
>     b) how to create a index.html file that can be used to navigate
> the directory structure
>     c) or info on any other programs that you know of that might do
> this job for me?
>     
> 
> Kind Regards Russell
> ==================
> www.windsorcycles.com.au
> bikes.no-ip.info
> Linux user #369094
> ==================

Hi, I don't know anything about igal, but you could use gThumb (however,
it doesn't support recursive directories, although, it does support
searching for images recursively, in other words: It support imagess
from directories and sub-directories but it will dump them all in one
level).

About your script, here is a try from me (don't trust it very mush, as I
have no idea what igal does or how should it be invoked, I just copyed
the igal line from your script):

------------------------------------------------------------------
#!/bin/sh
DIR=/home/www/html/pics

cd "$DIR" && \
find "$DIR" -type d | while read SUBDIR
do
	cd "$SUBDIR" && \
	echo Creating pictures in directory: "$SUBDIR" && \
	igal -a -f -wx 960 --bigy 450 -w 7 --www --title "$SUBDIR"
	cd "$DIR"
done
------------------------------------------------------------------

WARNING:
        Try it *only* after backing-up you original directory, don't be
        stupid and use it on the only copy of images you have. I did
        *NOT* test this script myself. In other words: USE IT AT YOUR
        OWN RISK.

Ziyad.





More information about the ubuntu-users mailing list