Ignore:
Timestamp:
Nov 1, 2008, 3:06:43 AM (12 years ago)
Author:
nico
Message:
  • Change test for php-cli mode in sample programs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.