> web-file-viewer.sourceforge.net > scripts

<= Parent directory | Home Directory revision date: 2008/08/11 14:19:39 UTC.
 

Show/Download this file as plain text ]

#!/bin/sh

# mkthumbs.sh

# 20050515 PixEye@bigfoot.com	Creation

nbps=1				# Number of wanted parameters (without options)
geometry="160x120"		# Maximum thumbnail size
tool="convert"			# Requires this tool as sub-program
thumbdir=".thumbnails"		# Thumbnails directory
cmd=`basename $0`		# Command name
usage="Usage: $cmd -h"		# Help message:
usage=$usage"\n\tDisplay this help message.\n"
usage=$usage"\nUsage: $cmd [-n] [-g <geometry>] <pictures> [...]"
usage=$usage"\n\tMakes thumbnails from current directory pictures."
usage=$usage"\n\tThis script requires $tool (from the ImageMagick package)."
usage=$usage"\n\tThe default geometry for thumbnails is $geometry.\n"
usage=$usage"\n\tThe -n option avoid already existing thumb overwriting."

if test `uname` != "HP-UX" ; then e="-e" ; fi

if [ "$#" -ge 1 -a "$1" = "-n" ] ; then optn=true ; shift ; else optn=false ; fi
if [ "$#" -ge 2 -a "$1" = "-g" ] ; then geometry="$2" ; shift 2 ; fi

if [ "$#" -lt $nbps -o "$1" = "-h" ] ; then	# Check parameters number
	echo $e $usage ; exit 2			# Display help message and exit
fi

ltool=`type -p $tool|grep -v "no $tool in "`	# Long name of the tool
if test -z "$ltool" ; then
	echo $e "$cmd: This script requires $tool." ; exit 1
fi

mkdir -p "$thumbdir"
while [ "$#" -ge 1 ]	# Better than a "for" (case of filenames with spaces)
do
	file="$1"
	if test ! -r "$file" ; then
		echo "$cmd: $file not readable!" 1>&2 ; shift ; continue
	fi
	if test -d "$file" ; then
		echo "$cmd: $file is a directory!" 1>&2 ; shift ; continue
	fi

	thumb="$thumbdir/$file"
	echo $e "$file ... \c"
	if test -r "$thumb" && "$optn" ; then
		echo "already existing." ; shift ; continue
	fi
	"$ltool" -interlace Plane -geometry "$geometry" "$file" "$thumb" \
		&& echo OK

	shift
done

exit 0

# Prefs for vim editing:
 vim:ts=8:sw=8:tw=80


mkgallery.sh
(5k)

mkthumbs.sh
(1k)

snap_ren.sh
(2k)

web-files-viewer_php.txt
(19k)

wfvgrc_php.txt
(1k)

Powered by Web File Viewer W3C XHTML 1.1 certified W3C CSS valid WFV revision date: 2005/12/04 11:43:26 UTC.