#!/bin/sh

IMGPATH="`dirname $1`"
IMG="`basename $1`"

# check filetype
FTYPE="`echo $IMG | rev | cut -f 1 -d '.' | rev`"
case $FTYPE in
 svg)
 cp -f ${IMGPATH}${IMG} $HOME/.config/wallpaper/thumb.png
 ;;
 png)
 resamplefixedheight ${IMGPATH}${IMG} $HOME/.config/wallpaper/thumb.png 32
 ;;
 gif)
 resamplefixedheight ${IMGPATH}${IMG} $HOME/.config/wallpaper/thumb.png 32
 ;;
 jpg)
 resamplefixedheight ${IMGPATH}${IMG} $HOME/.config/wallpaper/thumb.png 32
 ;;
 jpeg)
 resamplefixedheight ${IMGPATH}${IMG} $HOME/.config/wallpaper/thumb.png 32
 ;;
 *)
 cp -f /usr/share/icons/Tango/scalable/mimetypes/image-x-generic.svg $HOME/.config/wallpaper/thumb.png
 ;;
esac
 
