3
3
# Copyright 2007 Erlend Davidson <Erlend.Davidson@gmail.com>
4
# Copyright 2009 David D Lowe <DavidDLowe.flimm@gmail.com>
5
6
# This program is free software; you can redistribute it and/or modify
6
7
# it under the terms of the GNU General Public License as published by
16
17
# along with this program; if not, write to the Free Software
17
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
# modified by David D Lowe <DavidDLowe.flimm@gmail.com>, all his changes are released
20
# into the public domain http://creativecommons.org/licenses/publicdomain/
24
# ooo-thumbnailer file outfile
22
# ooo-thumbnailer file outfile size
24
# ooo-thumbnailer document.odt thumbnail.png 128
26
26
# command line parameters
31
31
test -f ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs && source ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs
33
if [ `dirname $ifile` != ${XDG_TEMPLATES_DIR:-$HOME/Templates} ]; then
34
if [ -e /usr/bin/convert ]; then
35
unzip -p "$ifile" Thumbnails/thumbnail.png | convert - +matte "png:$ofile" #-scale "$sizex$size"
33
# documents in the Templates directory are ignored
34
if [ `dirname "$ifile"` != ${XDG_TEMPLATES_DIR:-$HOME/Templates} ]; then
35
# use imagemagick if it's installed
36
# (currently, always the case until GNOME bug #576750 is fixed and
37
# dependency on imagemagick is removed)
38
if [ -x /usr/bin/convert ]; then
39
if [ "$size" == "" ]; then
40
unzip -p "$ifile" Thumbnails/thumbnail.png | convert - +matte "png:$ofile"
42
unzip -p "$ifile" Thumbnails/thumbnail.png | convert - +matte -scale ${size}x${size} "png:$ofile"
37
45
cache=${XDG_CACHE_HOME:-$HOME/.cache}
39
unzip "$ifile" Thumbnails/thumbnail.png -d "${cache}"
40
totem-gstreamer-video-thumbnailer "${cache}/Thumbnails/thumbnail.png" "$ofile" -s $size
47
unzip -o "$ifile" Thumbnails/thumbnail.png -d "${cache}"
48
if [ "$size" == "" ]; then
49
totem-video-thumbnailer "${cache}/Thumbnails/thumbnail.png" "$ofile"
51
totem-video-thumbnailer "${cache}/Thumbnails/thumbnail.png" "$ofile" -s $size
42
# uncomment the following line to include the OpenOffice.org logo in the thumbnail, requires imagemagick
43
#composite -gravity SouthEast /usr/share/icons/hicolor/48x48/mimetypes/openofficeorg3-oasis-text.png "$ofile" "$ofile"
54
# add appropriate OpenOffice.org logo if imagemagick is installed
55
if [ -x /usr/bin/composite ] && [ -e /usr/share/icons/hicolor/32x32/mimetypes/openofficeorg3-oasis-text.png ]; then
56
estensione=$(expr "$ifile" : '.*\(....\)')
59
composite -gravity SouthEast /usr/share/icons/hicolor/32x32/mimetypes/openofficeorg3-oasis-text.png "$ofile" "$ofile"
62
composite -gravity SouthEast /usr/share/icons/hicolor/32x32/mimetypes/openofficeorg3-oasis-presentation.png "$ofile" "$ofile"
65
composite -gravity SouthEast /usr/share/icons/hicolor/32x32/mimetypes/openofficeorg3-oasis-drawing.png "$ofile" "$ofile"
68
composite -gravity SouthEast /usr/share/icons/hicolor/32x32/mimetypes/openofficeorg3-oasis-spreadsheet.png "$ofile" "$ofile"