Hey all, I am running SuSE 8.0 professional [not that it makes much difference for this question]. What I am trying to do: Use a bash script to run several programs to resize some Jpeg images which have .JPG extenstions to 1/5 of their original size, and save the "thumbnail" as filename.jpeg, and then update a small little "index.html" file. Yes, a basic photogallery with clickable links. What I am having problems with: I don't want to have to go through the directory and convert each file every time. What would be your suggestions to enable it to do "only new pictures" and then build the html file? Also, I would like to have some sort of "Percent Done" display [updated every file that is converted], although realise that may require a lot more work and it isn't essential. There may be slight errors in the script below as I have re-written it, and am in the process of testing it , but you will get the idea of what I am doing with it :-) Thanks all! Here is what I have: #!/bin/bash for i in *.JPG ;\ do \ echo Converting $i to PNM ;\ jpegtopnm $i >temp.pnm ;\ echo Scaling $i to 20pc ;\ pnmscalefixed 0.2 temp.pnm >temp2.pnm ;\ echo Convert back to Jpeg thumbnail for $i ;\ pnmtojpeg temp2.pnm >`echo $i | sed s/.JPG/.jpeg/`;\ done echo "<html><head><title>Camera Images</title></head><body bgcolor="#000000">" >index.html for i in *.jpeg ;\ do \ echo "<a href=`echo $i | sed s/.jpeg/.JPG/`><img src=$i></a>"
index.html;\ done
echo "</body></html>" >>index.html Thanks! -- Tigersden Conferencing support. Tel: 0114 296 6594 Fax: 0114 296 6594 email: JJeffels@tigesden.demon.co.uk <mailto:JJeffels@tigesden.demon.co.uk>
"The Purple Tiger" <Jon@tigersden.demon.co.uk> writes:
Write a Makefile and use the command "make", e.g. if originals are in the org subdirectory: $ cat Makefile org = $(shell find org -name '*.jpg' -print) new = $(notdir $(org)) %.jpg : org/%.jpg convert $< $@ # put some params here index.html : $(new) echo $(new) > $@ # put your routine here .PHONY : clean new info new : $(new) clean : rm -f $(new) index.html info: @echo -n "Remains: " @make -n | grep convert | wc -l $ make info # to see how many files will be processed $ make # to create updated index.html $ make clean # to remove everything except original files Note 1: "watch -n 5 make info" can be started in another terminal window and monitor the progress. Note 2: Commands in the Makefile are indented by the '\t' character. Copy and paste converts them to spaces and "make" complains then. -- Alexandr.Malusek@imv.liu.se
Why making it yourself? Use the album tool from http://marginalhacks.com/Hacks/album/ Works great, Magnus The Purple Tiger wrote:
"The Purple Tiger" <Jon@tigersden.demon.co.uk> writes:
Write a Makefile and use the command "make", e.g. if originals are in the org subdirectory: $ cat Makefile org = $(shell find org -name '*.jpg' -print) new = $(notdir $(org)) %.jpg : org/%.jpg convert $< $@ # put some params here index.html : $(new) echo $(new) > $@ # put your routine here .PHONY : clean new info new : $(new) clean : rm -f $(new) index.html info: @echo -n "Remains: " @make -n | grep convert | wc -l $ make info # to see how many files will be processed $ make # to create updated index.html $ make clean # to remove everything except original files Note 1: "watch -n 5 make info" can be started in another terminal window and monitor the progress. Note 2: Commands in the Makefile are indented by the '\t' character. Copy and paste converts them to spaces and "make" complains then. -- Alexandr.Malusek@imv.liu.se
Why making it yourself? Use the album tool from http://marginalhacks.com/Hacks/album/ Works great, Magnus The Purple Tiger wrote:
participants (4)
-
Alexandr Malusek
-
Magnus Hagebris
-
Rickey Ingrassia
-
The Purple Tiger