|
|
fa0c75 |
#!/bin/bash
|
|
|
fa0c75 |
#
|
|
|
d5fac9 |
# svg_convertPngToThumbnail.sh -- This function provides
|
|
|
d5fac9 |
# post-rendition to create thumbnails from images produced by
|
|
|
d5fac9 |
# centos-art base-rendition. Thumbnails are created in PNG and JPG
|
|
|
d5fac9 |
# format for you to decide which is the more appropriate one. When no
|
|
|
d5fac9 |
# size is specified, thumbnails are created at 250 pixels width and
|
|
|
d5fac9 |
# height is automatically calculated to match the image ratio.
|
|
|
fa0c75 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa0c75 |
#
|
|
|
fa0c75 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa0c75 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
fa0c75 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
fa0c75 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
fa0c75 |
# General Public License for more details.
|
|
|
fa0c75 |
#
|
|
|
fa0c75 |
# You should have received a copy of the GNU General Public License
|
|
|
fa0c75 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
fa0c75 |
# ----------------------------------------------------------------------
|
|
|
fa0c75 |
# $Id$
|
|
|
fa0c75 |
# ----------------------------------------------------------------------
|
|
|
fa0c75 |
|
|
|
d5fac9 |
function svg_convertPngToThumbnail {
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Get image size.
|
|
|
d5fac9 |
local SIZE=''
|
|
|
fa0c75 |
local SIZES=$(render_getConfigOption "$ACTION" '2-')
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Check image sizes and do convertion.
|
|
|
fa0c75 |
if [[ "$SIZES" == "" ]];then
|
|
|
fa0c75 |
SIZES='250'
|
|
|
fa0c75 |
fi
|
|
|
fa0c75 |
|
|
|
ed2fd5 |
# Check base file existence.
|
|
|
ed2fd5 |
cli_checkFiles "${FILE}.png"
|
|
|
ed2fd5 |
|
|
|
fa0c75 |
# Create thumbnails.
|
|
|
fa0c75 |
for SIZE in $SIZES;do
|
|
|
0ff158 |
cli_printMessage "${FILE}-thumb-${SIZE}.png" --as-savedas-line
|
|
|
ed2fd5 |
convert -thumbnail ${SIZE} ${FILE}.png ${FILE}-thumb-${SIZE}.png
|
|
|
0ff158 |
cli_printMessage "${FILE}-thumb-${SIZE}.jpg" --as-savedas-line
|
|
|
ed2fd5 |
convert -thumbnail ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.jpg
|
|
|
0ff158 |
cli_printMessage "${FILE}-thumb-${SIZE}.pdf" --as-savedas-line
|
|
|
ed2fd5 |
convert -thumbnail ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.pdf
|
|
|
fa0c75 |
done
|
|
|
fa0c75 |
|
|
|
fa0c75 |
}
|