×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles
    Revision as of 14:16, 23 October 2008 by imported>mutante (New page: 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/...)
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
    edgar@cgn:~$ vi mk_gallery.sh
    

    <HighlightSyntax>

    1. !/bin/bash
    2. create image gallery for Edgar
    1. make thumbs

    for file in ~/public_html/images/*

     do convert -size 100 $file ~/public_html/images/thumbs/th-`basename $file`
    

    done

    1. make html

    php /home/edgar/mk_gallery.php > /home/edgar/public_html/index.html

    </HighlightSyntax>

    edgar@cgn:~$ vi mk_gallery.php
     
    

    <HighlightSyntax> <?php

    1. Make the gallery html for Edgar's image dump
    2. mutante / s23
    1. Pathes to images, thumbnails and the html to be generated

    $image_dir="/home/edgar/public_html/images"; $thumbs_dir="/home/edgar/public_html/thumbs"; $html_file="/home/edgar/public_html/index.html";


    1. Create a html gallery

    function mkgallery($image_dir,$thumbs_dir,$html_dir) {

    1. 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;

    1. HTML Footer

    $html_foot = <<< FNORD

    Generated by FnordGallery V2.3

    </body> </html> FNORD;

    1. HTML Body loop

    foreach (glob("$image_dir/*") as $filename) { $basename=basename($filename);

    $html_body.="

    <a href=\"./images/$basename\"><img src=\"./images/thumbs/th-$basename\" alt=\"$basename thumbnail\"></img></a> $basename - size ". filesize($filename) ." B

    \n";

    }

    1. Give it back!

    $html_output=$html_head.$html_body.$html_foot; return $html_output; }

    1. Do it!

    print mkgallery($image_dir,$thumbs_dir,$html_dir);

    ?> </HighlightSyntax>

    edgar@cgn:~$ ./mk_gallery.sh
    

    -> http://cgn.sq23.de/~edgar/

    (valid)

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.