I might use parts of this code when I make the multi-page document gallery.
Code: Select all
#! /bin/sh
# put this script in the folder with the images.
title=$(pwd | awk -F / '{print $NF}')
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/root/.bookmarks/bm/css/gallery.css\">" >> index.html
echo "</head>" >> index.html
echo "<body>" >> index.html
echo "<div class=\"header\">$title</div>" >> index.html
fext=$(echo ".JPG" | yad --mouse --width=1000 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
for i in *$fext; do
convert.im6 -resize 600'x'600 "$i" "tn_"$i
yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5" \
--button="EXIT:6"
ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 600'x'600 "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1000 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div class=\"des\">$title - $desc</div>" >> index.html
echo "<img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\">" >> index.html;
fi
if [[ $ret -eq 6 ]]; then
echo "</body>" >> index.html
echo "</html>" >> index.html
exit 0
fi
done;
echo "</body>" >> index.html
echo "</html>" >> index.html