From 20407702b92cb93970eaa4a71e659f383d2f92a5 Mon Sep 17 00:00:00 2001 From: jimmacfx Date: Fri, 25 Nov 2005 22:45:21 +0000 Subject: 0.11 git-svn-id: https://forgesvn1.novell.com/svn/original/trunk@8 4fa712ea-3c06-0410-9261-c11b4c06c003 --- convert/imgconv | 238 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100755 convert/imgconv (limited to 'convert/imgconv') diff --git a/convert/imgconv b/convert/imgconv new file mode 100755 index 0000000..854b664 --- /dev/null +++ b/convert/imgconv @@ -0,0 +1,238 @@ +#!/bin/bash + +# little script to generate image galleries for use with original. +# uses imagemagick's convert +# (c) 2005 boris de laage +# based on imgconv by Jakub Steiner +# +# The 'help' section sucks, as my english does. + + +#default options +dir=./web-gallery +zip=0 +mq=0 +hq=0 +interactive=0 +verbose=echo + +#info.txt stuff +gal_auth="" +gal_name="" +gal_desc="" +gal_date="" +gal_user="" +gal_pass="" + +# convert options +convertor=`which convert` +extra_ops="-strip" + +# This script +name=`basename $0` + +# getopt stuff +shortopts="a:hHin:d:D:Mqo:Z" +longopts="author:quiet,help,interactive,name:,date:,description:,\ +mq,hq,output:,archive" + + + +function echo_help { +cat <" > $dir/.htaccess +echo " deny from all" >> $dir/.htaccess +echo "" >> $dir/.htaccess + + +$verbose "Generating O.R.I.G.I.N.A.L gallery in $dir" + +files=$(echo $@ | sed 's/ /\n/g' | sort) + +#files=$@ + +i=1 +for imagefile in $files; do + + good_file "$imagefile" + if [ $? != 0 ]; then + $verbose "$imagefile is not a JPEG or PNG file, skipped" + continue + fi + + $verbose -n "converting $imagefile " + + $verbose -n "." + $convertor -geometry 120x120 -modulate 100,140,100 -unsharp 1x20 \ + -quality 60 $extra_opts "$imagefile" $dir/thumbs/img-$i.jpg + + $verbose -n "." + $convertor -geometry 640x480 -modulate 100,130,100 -unsharp 1x5 \ + -quality 90 "$imagefile" $dir/lq/img-$i.jpg + + if [ $mq -gt 0 ]; then + $verbose -n "." + $convertor -geometry 1024x768 -modulate 100,130,100 -unsharp 1x5 \ + -quality 80 "$imagefile" $dir/mq/img-$i.jpg + fi + + if [ $hq -gt 0 ] ; then + $verbose -n "." + cp "$imagefile" $dir/hq/img-$i.jpg + fi + + # template for comment + echo "Photo $i " > $dir/comments/$i.txt + + + i=`expr $i + 1` + $verbose " done" +done + +# zip stuff +if [ $zip -gt 0 ]; then + $verbose "archiving" + [ $mq ] && zip -R $dir/zip/mq.zip web-gallery/mq/*.jpg + [ $hq ] && zip -R $dir/zip/hq.zip web-gallery/hq/*.jpg +fi + +#info.txt +protect=n +if [ $interactive == 1 ]; then + echo -n "Gallery name [$gal_name]: " + read gal_name + echo -n "Description: " + read gal_desc + echo -n "Author [$gal_auth]: " + read gal_auth + echo -n "Date [$gal_date]: " + read gal_date + echo -n "Resctrict access ? [y/N]: " + read protect + if [ "$protect" == "y" ] || [ "$protect" == "Y" ]; then + echo -n "restricted user [$gal_user]: " + read gal_user + echo -n "restricted password [$gal_pass]: " + read gal_pass + fi +fi + +[ "$gal_name" != "" ] && echo "name|$gal_name" >> $dir/info.txt +[ "$gal_auth" != "" ] && echo "author|$gal_auth" >> $dir/info.txt +[ "$gal_date" != "" ] && echo "date|$gal_date" >> $dir/info.txt +[ "$gal_desc" != "" ] && echo "description|$gal_desc" >> $dir/info.txt +[ "$gal_user" != "" ] && echo "restricted_user|$gal_user" >> $dir/info.txt +[ "$gal_pass" != "" ] && echo "restricted_password|$gal_pass" >> $dir/info.txt -- cgit v1.2.3