Mam problem podczas kiedy uruchamiam skrypt w bashu do tworzenia galerii, gdy zaczyna on robić zmianę rozmiaru zdjęć pojawia się komunikat:
Kod: Zaznacz cały
convert: no decode delegate for this image format `DSC02584.JPG'
Kod: Zaznacz cały
convert: no decode delegate for this image format `DSC02584.JPG'
Kod: Zaznacz cały
#!/bin/bash
#
# autor: Kamil Porembinski
# mail: paszczak [at] thecamels.org
# www: [url]www.thecamels.org[/url]
#
##################################################################################
# simply_gc is an automatic and simply gallery creator.
# Execute in a directory with JPG files.
# The script requires the tools convert from ImageMagick and jhead.
#
##################################################################################
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
##################################################################################
# Configuration:
title="My Gallery" #Title of your gallery
size_miniatures="160x160" #Size of image miniatures
size_slides="640x640" #Size of image miniatures
row=5 #How many rows will be created in file
# Const. Don't change!
version="Simply Gallery Creator 1.0"
programs=(mkdir rm cp sort jhead convert grep find sed du basename)
function test_script
{
error=0
echo -e "Please wait, while testing...\n"
if [ -w `pwd` ]
then
echo -e "Work directory is writable\t[ OK ]"
else
echo -e "Work directory is writable\t[ FALSE ]"
fi
i=0
while [ $i -lt 11 ]; do
path=`type -p ${programs[$i]}`
if [ "$path" = "" ]
then
echo -e "Found ${programs[$i]}\t\t\t[ FALSE ]"
error=1
else
if [ -x $path ]
then
echo -e "Found ${programs[$i]}\t\t\t[ OK ]"
else
echo -e "Found ${programs[$i]}\t\t\t[ FALSE ]"
error=1
fi
fi
i=`expr $i + 1`
done
if [ "$error" = "1" ]
then
echo -e "\nSome programs are missing. Install them and run script again."
exit 0
fi
}
function start
{
echo -e "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<meta http-equiv=\"Content-type\" content=\"text/html; charset=iso-8859-2\">
<meta name=\"Keywords\" content=\"\">
<meta name=\"Description\" content=\"\">
<meta name=\"Author\" content=\"Kamil Porembinski\">
<meta name=\"robots\" content=\"index,follow\">
<meta name=\"Language\" content=\"pl\">
<meta name=\"Generator\" content=\"Simply GC\">
<title>$title</title>
</head>
<body>" > $1
}
function stop
{
echo -e "<hr>
<div style=\"font-size: 10px; text-align: center; font-weight: normal;\">
<a href=\"http://validator.w3.org/check?uri=referer\">This Page Is Valid HTML 4.01 Transitional!</a>
created by <a href=\"http://www.thecamels.org/\">[b]$version[/b]</a>
</div>
</body>
</html>" >> $1
}
function files
{
# Change big characters to small
for name in *.jpg
do
mv -f $name `echo $name | tr '[A-Z]' '[a-z]'`
done
# Find and count number of image files
files=(`find . -maxdepth 1 -iregex ".*\.jpg$" -type f -print | sort -f`)
# Remember file names into a $filenames
for (( i=0; i < ${#files[@]}; i++ ));
do
filenames[$i]=`basename "${files[$i]}" | sed s/\ /_/g`;
done
# Create miniatures and slides
echo -e "\nPlease wait while miniatures, slides and pages are creating..."
echo -e "<table align=\"center\" border=\"0\" cellspacing=\"4\" cellpadding=\"4\">\n\t<tr>\n\t\t<td colspan=\"$row\">\n\t\t\t[align=center]<h1>$title</h1>[/align]" >> index.htm
for (( i=0; i < ${#filenames[@]}; i++ ));
do
echo -e "Resizing ${filenames[$i]}\t\t[`expr $i + 1`/${#filenames[@]}]"
convert -scale $size_miniatures ${filenames[$i]} thumbnails/${filenames[$i]}
convert -scale $size_slides ${filenames[$i]} slides/${filenames[$i]}
# Create main page
if [ "`expr $i % $row`" = "0" ]
then
echo -e "\t</tr>\n\t<tr>" >> index.htm
fi
date_and_time=`jhead ${filenames[$i]} | grep -e "Date/Time" | awk '{print $3" "$4}'`
echo -e "\t\t<td align=\"center\"><a href=\"$i.htm\"><img src=\"thumbnails/${filenames[$i]}\" alt=\"${filenames[$i]}\" border=\"0\"></a>
$date_and_time</td>" >> index.htm
# Creating subpages
echo -e "Creating $i.htm\t\t\t[`expr $i + 1`/${#filenames[@]}]"
touch $i.htm
start $i.htm
echo -e "<table align=\"center\" border=\"0\">\n\t<tr>\n\t\t<td align=\"center\">" >> $i.htm
echo -e "\t\t\t<h1>${filenames[$i]}</h1>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td align=\"center\">" >> $i.htm
prev=`expr $i - 1`
next=`expr $i + 1`
if [ "$prev" -lt "0" ]
then
page_prev=index
else
page_prev=$prev
fi
if [ $next -gt ${#filenames[@]} ]
then
page_next=index
else
page_next=$next
fi
echo -e "\t\t\t[<a href=\"$page_prev.htm\">prev</a>][<a href=\"index.htm\">index</a>][<a href=\"$page_next.htm\">next</a>]\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td align=\"center\">" >> $i.htm
echo -e "\t\t\t<a href=\"${filenames[$i]}\"><img src=\"slides/${filenames[$i]}\" alt=\"${filenames[$i]}\" border=\"0\"></a>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td>" >> $i.htm
jhead=`jhead ${filenames[$i]}`
echo -e "<pre>$jhead</pre>\n\t\t</td>\n\t</tr>\n</table>" >> $i.htm
stop $i.htm
done
echo -e "\t</tr>\n</table>" >> index.htm
}
# Script
if test $# = 0
then
start=`date +%s`
test_script
mkdir tmp
cp *.jpg tmp
cd tmp
mkdir thumbnails
mkdir slides
touch index.htm
start index.htm
files
stop index.htm
stop=`date +%s`
echo -e "\nDone."
echo -e "Statistics:"
echo -e "Generation time:\t`expr $stop - $start` seconds"
cd ..
echo -e "Size:\n`du tmp`"
echo -e "Files:\t\t\t`ls -l -R | awk '{print $9}' | grep -G .*\..* | wc -l`"
exit 0
fi
for parametr in $*
do
case $parametr in
-v | --version)
echo "$version is Free Software released under the GNU/GPL License."
exit 0
break
;;
-h | --help)
echo "$version is Free Software released under the GNU/GPL License."
echo "Using: ./simply_gc.sh"
echo -e "\n Options:"
echo -e "\t -v, --version \t Show version"
echo -e "\t -h, --help \t\t Show help"
echo -e "\n www.thecamels.org"
exit 0
break
;;
-*)
echo "$0: invalid option $*"
echo "Try './simply_gc.sh --help' for more information."
exit 0
break
;;
esac
done