Content added Content deleted
imported>mutante mNo edit summary |
imported>mutante mNo edit summary |
||
Line 22: | Line 22: | ||
# mutante / s23 |
# mutante / s23 |
||
# Pathes to images |
# Pathes to images and thumbnails |
||
$image_dir="/home/edgar/public_html/images"; |
$image_dir="/home/edgar/public_html/images"; |
||
$thumbs_dir="/home/edgar/public_html/thumbs"; |
$thumbs_dir="/home/edgar/public_html/thumbs"; |
Latest revision as of 14:20, 23 October 2008
edgar@cgn:~$ vi mk_gallery.sh
<HighlightSyntax>
- !/bin/bash
- create image gallery for Edgar
- make thumbs
for file in ~/public_html/images/*
do convert -size 100 $file ~/public_html/images/thumbs/th-`basename $file`
done
- make html
php /home/edgar/mk_gallery.php > /home/edgar/public_html/index.html
</HighlightSyntax>
edgar@cgn:~$ vi mk_gallery.php
<?php # Make the gallery html for Edgar's image dump # mutante / s23 # Pathes to images and thumbnails $image_dir="/home/edgar/public_html/images"; $thumbs_dir="/home/edgar/public_html/thumbs"; # Create a html gallery function mkgallery($image_dir,$thumbs_dir) { # HTML Header $html_head = <<< FNORD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head><title>Edgar's image gallery</title> <meta name="author" content="S23" /> </head> <body> FNORD; # HTML Footer $html_foot = <<< FNORD <p>Generated by FnordGallery V2.3</p> </body> </html> FNORD; # HTML Body loop foreach (glob("$image_dir/*") as $filename) { $basename=basename($filename); $html_body.="<p><a href=\"./images/$basename\"><img src=\"./images/thumbs/th-$basename\" alt=\"$basename thumbnail\"></img></a> $basename - size ". filesize($filename) ." B </p> \n"; } # Give it back! $html_output=$html_head.$html_body.$html_foot; return $html_output; } # Do it! print mkgallery($image_dir,$thumbs_dir); ?>
edgar@cgn:~$ ./mk_gallery.sh
(valid)