Changeset 3318 for libcaca/trunk


Ignore:
Timestamp:
Nov 7, 2008, 10:03:26 AM (11 years ago)
Author:
bsittler
Message:

add a reset button, move usage to "stdout", and stop hyperlinking the
logo filename in the example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/examples/www/img2txt.php

    r3317 r3318  
    222222function usage($argc, $argv)
    223223{
    224         global $stderr;
    225         $stderr .= sprintf("Usage: %s [OPTIONS]... <IMAGE>\n", $argv[0]);
    226         $stderr .= sprintf("Convert IMAGE to any text based available format.\n");
    227         $stderr .= sprintf("Example : -W 80 -f html logo-caca.png\n\n", $argv[0]);
    228         $stderr .= sprintf("Options:\n");
    229         $stderr .= sprintf("  -h, --help\t\t\tThis help\n");
    230         $stderr .= sprintf("  -v, --version\t\t\tVersion of the program\n");
    231         $stderr .= sprintf("  -W, --width=WIDTH\t\tWidth of resulting image\n");
    232         $stderr .= sprintf("  -H, --height=HEIGHT\t\tHeight of resulting image\n");
    233         $stderr .= sprintf("  -x, --font-width=WIDTH\t\tWidth of output font\n");
    234         $stderr .= sprintf("  -y, --font-height=HEIGHT\t\tHeight of output font\n");
    235         $stderr .= sprintf("  -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n");
    236         $stderr .= sprintf("  -c, --contrast=CONTRAST\tContrast of resulting image\n");
    237         $stderr .= sprintf("  -g, --gamma=GAMMA\t\tGamma of resulting image\n");
    238         $stderr .= sprintf("  -d, --dither=DITHER\t\tDithering algorithm to use :\n");
     224        global $stdout;
     225        $stdout .= sprintf("Usage: %s [OPTIONS]... <IMAGE>\n", $argv[0]);
     226        $stdout .= sprintf("Convert IMAGE to any text based available format.\n");
     227        $stdout .= sprintf("Example : -W 80 -f html logo-caca.png\n\n", $argv[0]);
     228        $stdout .= sprintf("Options:\n");
     229        $stdout .= sprintf("  -h, --help\t\t\tThis help\n");
     230        $stdout .= sprintf("  -v, --version\t\t\tVersion of the program\n");
     231        $stdout .= sprintf("  -W, --width=WIDTH\t\tWidth of resulting image\n");
     232        $stdout .= sprintf("  -H, --height=HEIGHT\t\tHeight of resulting image\n");
     233        $stdout .= sprintf("  -x, --font-width=WIDTH\t\tWidth of output font\n");
     234        $stdout .= sprintf("  -y, --font-height=HEIGHT\t\tHeight of output font\n");
     235        $stdout .= sprintf("  -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n");
     236        $stdout .= sprintf("  -c, --contrast=CONTRAST\tContrast of resulting image\n");
     237        $stdout .= sprintf("  -g, --gamma=GAMMA\t\tGamma of resulting image\n");
     238        $stdout .= sprintf("  -d, --dither=DITHER\t\tDithering algorithm to use :\n");
    239239        $list = caca_get_dither_algorithm_list(caca_create_dither(imagecreate(1, 1)));
    240240        foreach($list as $type => $name)
    241241        {
    242                 $stderr .= sprintf("\t\t\t%s: %s\n", $type, $name);
    243         }
    244 
    245         $stderr .= sprintf("  -f, --format=FORMAT\t\tFormat of the resulting image :\n");
     242                $stdout .= sprintf("\t\t\t%s: %s\n", $type, $name);
     243        }
     244
     245        $stdout .= sprintf("  -f, --format=FORMAT\t\tFormat of the resulting image :\n");
    246246        $list = caca_get_export_list();
    247247        foreach($list as $type => $name)
    248248        {
    249                 $stderr .= sprintf("\t\t\t%s: %s\n", $type, $name);
     249                $stdout .= sprintf("\t\t\t%s: %s\n", $type, $name);
    250250        }
    251251}
     
    509509<input id="args" name="args" type="text" value="<?= isset($_REQUEST['args']) ? htmlspecialchars($_REQUEST['args']) : '' ?>" size="80" />
    510510<br />
    511 <input type="submit" />
     511<input type="submit" /> <input type="reset" />
    512512</form>
    513513<?php
     
    515515        if(strlen($stderr))
    516516        {
    517                 ?><pre xml:space="preserve"><em><?= preg_replace('!(logo-caca[.]png)!', '<a href="$1">$1</a>', htmlspecialchars($stderr)) ?></em></pre><?php
     517                ?><pre xml:space="preserve"><strong><?= htmlspecialchars($stderr) ?></strong></pre><?php
    518518                        ;
    519519        }
Note: See TracChangeset for help on using the changeset viewer.