Changeset 3177 for libcaca/trunk


Ignore:
Timestamp:
Nov 1, 2008, 3:06:43 AM (12 years ago)
Author:
nico
Message:
  • Change test for php-cli mode in sample programs
Location:
libcaca/trunk/caca-php/examples
Files:
6 edited

Legend:

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

    r3175 r3177  
    4747       
    4848
    49 if (!posix_isatty(STDOUT))
     49if (php_sapi_name() != "cli") {
    5050        die("You have to run this program with php-cli!\n");
     51}
    5152
    5253just_for_fun();
  • libcaca/trunk/caca-php/examples/demo.php

    r3176 r3177  
    362362
    363363
    364 if (!posix_isatty(STDOUT))
     364if (php_sapi_name() != "cli") {
    365365        die("You have to run this program with php-cli!\n");
     366}
    366367
    367368main();
  • libcaca/trunk/caca-php/examples/dithering.php

    r3175 r3177  
    1212 */
    1313
    14 if (!posix_isatty(STDOUT))
     14if (php_sapi_name() != "cli") {
    1515        die("You have to run this program with php-cli!\n");
     16}
    1617
    1718$img = imagecreatefrompng(dirname(__FILE__)."/logo-caca.png");
    18 if (!$img)
     19if (!$img)  {
    1920        die("Can not open image.\n");
     21}
    2022
    2123$dither = caca_create_dither($img);
    22 if (!$dither)
     24if (!$dither)  {
    2325        die("Can not create dither. Maybe you compiled caca-php without gd support.\n");
     26}
    2427
    2528$canvas = caca_create_canvas(0, 0);
    2629$display = caca_create_display($canvas);
    27 if (!$display)
     30if (!$display)  {
    2831        die("Can not create display.\n");
     32}
    2933
    3034caca_dither_bitmap($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img);
  • libcaca/trunk/caca-php/examples/figfont.php

    r3175 r3177  
    2424}
    2525
    26 if (!posix_isatty(STDOUT))
     26if (php_sapi_name() != "cli") {
    2727        die("You have to run this program with php-cli!\n");
     28}
    2829
    2930if ($argc < 3) {
  • libcaca/trunk/caca-php/examples/polyline.php

    r3175 r3177  
    1919}
    2020
    21 if (!posix_isatty(STDOUT))
     21if (php_sapi_name() != "cli") {
    2222        die("You have to run this program with php-cli!\n");
     23}
    2324
    2425$canvas = caca_create_canvas(0, 0);
  • libcaca/trunk/caca-php/examples/text.php

    r3175 r3177  
    1616 */
    1717
    18 if (!posix_isatty(STDOUT))
     18if (php_sapi_name() != "cli") {
    1919        die("You have to run this program with php-cli!\n");
     20}
    2021
    2122$string =  <<<EOT
Note: See TracChangeset for help on using the changeset viewer.