Simplest picture gallery (bash, convert)

This is more for me than for others, I just thought someone else couldĀ also use it ;)

mkdir orig ; mkdir small ; mkdir thumb
# upload all pics into "orig" directory
ls ./orig | while read X ; do convert -resize 40% ./orig/"$X" ./small/"$X" ; done
ls ./orig | while read X ; do convert -resize 5% ./orig/"$X" ./thumb/"$X" ; done
ls ./small/ | while read X ; do echo "<a href='$X.html'><img src='thumb/$X' /></a>" >> index.html ; done
ls ./small/ | while read X ; do echo "<a href='./orig/$X'><img src='small/$X' /></a>" > "$X".html ; done

The result is just a basic gallery, but surprisingly, it works and it does not screw pictures like facebook and others sharing services. Of course, you will need to have some webserver somewehere to share it with others.

What I also usually do is something like:

 zip -j ./orig/all.zip ./orig/*
 zip -j ./small/all.zip ./small/*

to allow easy download of all pics.

Enjoy! :)

This entry was posted in other. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>