Are you a regular stikked user? Signup so you can keep track of your pastes!
  1. #!/bin/bash
  2. if [ -z $1 ] ; then NIMI=`date +%d.%m.%Y`; else NIMI="$@" ; fi
  3.  
  4. echo 'Generating thumbnails to thumbs/'
  5. if [ ! -d thumbs ] ; then mkdir thumbs ; fi
  6. for s in *.jpg ; do echo "Processing: $s" ; convert -geometry 320x420 "$s" "thumbs/th_$s" ; done
  7.  
  8. prefiksi="Gallery "
  9. echo 'Flooding beginning of index.html'
  10. echo "<html><head><title>$prefiksi$NIMI</title>" > index.html
  11. echo '<style type=\"text/css\"> table { margin-right:auto; margin-left:auto; text-align:center }</style>' >> index.html
  12. echo '<base target=\"_blank\" /></head>' >> index.html
  13. echo '<body bgcolor=\"#000000\" text=\"#FFFFFF\">' >> index.html
  14. echo "<h2 align=\"center\">$prefiksi$NIMI</h2><p>" >> index.html
  15. echo 'Generating tables...'
  16. rivilla=3
  17. x=0
  18. for s in *.jpg
  19. do
  20.         if [ $x -eq $rivilla ] ; then echo '</tr></table>' >> index.html ; x=0 ; fi
  21.         if [ $x -eq 0 ] ; then echo "<table><tr>" >> index.html ; fi
  22.         if [ $x -lt $rivilla ]
  23.         then
  24.                 floodbeg="<td><a href=\"$s\"><img src=\"thumbs/th_$s\"></a><br>$s<br>"
  25.                 filesize=`identify -format "%b" "$s"`
  26.                 resolution=`identify -format "%wx%h" "$s"`
  27.                 if [ `expr index $filesize b` -eq 0 ] #if the size is already in bytes do nothing
  28.                 then
  29.                         filesizekB=`expr $filesize / 1024`
  30.                         if [ $filesizekB -gt 1 ] ; then echo $floodbeg$filesizekB"kb "$resolution"</td>" >> index.html ; fi
  31.                 else
  32.                         echo $floodbeg$filesize' '$resolution >> index.html
  33.                 fi
  34.                 x=$(($x+1))
  35.         fi
  36. done
  37. echo 'Finalizing index.html'
  38. if [ $x -gt 0 ]
  39. then
  40.         while [ $x -lt $rivilla ] ; do echo '<td>&nbsp;</td>' >> index.html; x=$(($x+1)) ; done
  41.         echo '</tr></table>' >> index.html
  42. fi
  43. echo '</p></body></html>' >> index.html
  44.  

Reply to "thumbnailer"

Here you can reply to the paste above

Create a snipurl

Make Private

Feeling clever? Set some advanced options.