updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / nautilus-gkim / GKIM_gallery
blob19cc4c492811c544cd33d3712634628d4e999ead
1 #!/bin/sh
2 # Create a html gallery
3 FILE="";
4 let "nbfiles = $#"
5 #kdeinstdir=`kde4-config --prefix`
6 KIM_DIR=/usr/share/GKIM/gallery
7 if TITLE=`zenity --entry --title="Titre" --text="Veuillez saisir le titre"`
8 then
9 echo "TITLE = $TITLE";
10 else
11 exit 0;
14 if AUTHOR=`zenity --entry --title="Titre" --text="Veuillez saisir l'auteur" --entry-text="$USER"`
15 then
16 echo "AUTHOR = $AUTHOR";
17 else
18 exit 0;
21 DATE=`date '+%A %-d %B %Y'`;
22 SCALE_1="800x800";
23 SCALE_2="200x200";
24 if K=`zenity --entry --title="Nombre de colonnes" --text="Veuillez saisir le nombre de colonnes : " --entry-text="4"`
25 then
26 echo "K = $K";
27 else
28 exit 0;
31 if DIR=`zenity --title "Selecionner le repertoire où stocker la gallery" --file-selection --directory`
32 then
33 echo "DIR = $DIR";
34 else
35 exit 0;
38 W="200";
39 H="150";
42 # Creation of directories
43 mkdir $DIR/images;
44 mkdir $DIR/thumbs;
45 # Header of $DIR/index.html
46 cp $KIM_DIR/index.part1_gallery $DIR/index.html;
47 echo '<h1>'$TITLE'</h1>' >> $DIR/index.html;
48 echo '<h5>Auteur: '$AUTHOR'<br>Date: '$DATE'</h5>' >> $DIR/index.html;
49 echo '<table><tr>' >> $DIR/index.html;
51 (compteur=0;
52 tmp=0;
53 for i in "$@";do
54 if [ -f "$i" ];then
55 #test if cancel button has been pushed
56 let "compteur +=1"
57 let "tmp +=1"
58 FILE="$i";
59 IMAGE=`basename "$FILE"`;
60 convert -resize $SCALE_1 "$FILE" $DIR/images/"$IMAGE";
61 convert -resize $SCALE_2 "$FILE" $DIR/thumbs/"$IMAGE";
62 W2=`identify -format "%w" $DIR/images/"$IMAGE"`;
63 H2=`identify -format "%h" $DIR/images/"$IMAGE"`;
64 echo '<td align='center'>' >> $DIR/index.html;
65 if [ "$H2" -lt "$W2" ];
66 then echo '<a href="images/'"$IMAGE"'"><img class="photo" src="thumbs/'"$IMAGE"'" width="'$W'" height="'$H'" alt="thumbs/'"$IMAGE"'" title="'"$IMAGE"'"></a>' >> $DIR/index.html;
67 else echo '<a href="images/'"$IMAGE"'"><img class="photo" src="thumbs/'"$IMAGE"'" width="'$H'" height="'$W'" alt="thumbs/'"$IMAGE"'" title="'"$IMAGE"'"></a>' >> $DIR/index.html;
68 fi;
69 echo '<p>'"$IMAGE"'</p>' >> $DIR/index.html;
70 echo '</td>' >> $DIR/index.html;
71 if [ "$tmp" -eq "$K" ];
72 then echo '</tr><tr>' >> $DIR/index.html;
73 tmp=0;
75 fi;
76 done
77 )|zenity --progress \
78 --title="Création de la gallery" \
79 --text="traitement" \
80 --percentage=0;
82 cat $KIM_DIR/index.part2_gallery >> $DIR/index.html;
85 firefox $DIR/index.html;