diff --git a/caca-php/examples/www/dithering.php b/caca-php/examples/www/dithering.php new file mode 100755 index 0000000..327f98b --- /dev/null +++ b/caca-php/examples/www/dithering.php @@ -0,0 +1,42 @@ + + +Caca power! + + + + + + * + * This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING for more details. + */ + +$src = "logo-caca.png"; +$img = imagecreatefrompng(dirname(__FILE__)."/".$src); +if (!$img) { + die("Can not open image.\n"); +} + +$dither = caca_create_dither($img); +if (!$dither) { + die("Can not create dither. Maybe you compiled caca-php without gd support.\n"); +} + +$canvas = caca_create_canvas(100, 40); + +caca_dither_bitmap($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img); + +echo caca_export_string($canvas, "html3"); +echo ""; + +?> + + + diff --git a/caca-php/examples/www/figlet.php b/caca-php/examples/www/figlet.php index 5e896f8..756c7c8 100755 --- a/caca-php/examples/www/figlet.php +++ b/caca-php/examples/www/figlet.php @@ -8,7 +8,7 @@ * * This program is free software. It comes without any warranty, to @@ -47,7 +47,12 @@ function show_figlet($str, $font) { echo caca_export_string($cv, "html3"); } -$dir = opendir($path = "/usr/share/figlet/"); +$path = "/usr/share/figlet/"; +if (!is_dir($path)) { + die("can not open directory $path.\n"); +} + +$dir = opendir($path); while (($it = readdir($dir)) != false) { if (is_file($path.$it) and ereg("\.[tf]lf$", $it)) { echo "font : $it\n
";
diff --git a/caca-php/examples/www/logo-caca.png b/caca-php/examples/www/logo-caca.png
new file mode 100755
index 0000000..859e27a
Binary files /dev/null and b/caca-php/examples/www/logo-caca.png differ