#!/bin/sh # McPics is no longer maintained by its author. # Don't use it :) # McPics 0.2.6 (c) 2002 mackstann (mack at incise.org) # You need image magick installed! # make sure this is the same as in install.sh # if you changed it! SHAREPATH='/usr/local/share/mcpics' thumbdir='thumbs' #no trailing slash! width='120' #you will almost always want 4:3 images height='90' #so, $height should be 3/4 of $width # if the sizes are non standard (not 120x90), # create the mcpics.sizes file to indicate the size. if [ ! $width = '120' -o $height = '90' ] then echo "creating file mcpics.sizes..." echo "" > ${PWD}/mcpics.sizes fi echo "image size is ${width}x${height}." echo -e "thumbnail directory is:\t${thumbdir}/\n" if [ ! -d ${thumbdir} ] then echo -e "${thumbdir}/ does not exist, lets make it.\n" mkdir $thumbdir fi /bin/ls -1 | grep -i -E jpg$\|jpeg$\|gif$\|png$ > mcpics.filelist num=`cat mcpics.filelist | wc -l` echo -e "found $num images to convert.\n" num=`echo $num + 1 - 1 | bc` #someone tell me how to strip out the spaces from wc's output ;) echo -ne "converting to ${width}x${height}...\n\n[${num} images left] " while read F do if [ ! -e "${thumbdir}/${F}" ] ; then echo "making ${thumbdir}/${F}" echo "converting ${F}" convert -resize ${width}x${height} "$F" "${thumbdir}/${F}" num=`echo $num - 1 | bc` echo -n "[${num} images left] " fi done < mcpics.filelist echo -e "\ndone converting images." echo "copying ${SHAREPATH}/mcpics.php to ./index.php\n" cp -v ${SHAREPATH}/mcpics.php ${PWD}/index.php echo -e "\ndone!\n" exit 0