Changeset 3201 for libcaca


Ignore:
Timestamp:
Nov 2, 2008, 4:27:58 AM (11 years ago)
Author:
bsittler
Message:

seems to work

File:
1 edited

Legend:

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

    r3200 r3201  
    1 #!/usr/bin/php5
    2 <?
     1<?php
     2$pngmode = isset($_REQUEST['png']) ? ($_REQUEST['png'] != '') : false;
    33
     4if ($pngmode)
     5    header('Content-Type: image/png');
     6else
     7    header('Content-Type: text/html; charset=UTF-8');
     8
     9if (! $pngmode)
     10{
     11?>
     12<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     13    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     14
     15<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     16<head>
     17<title>Я люблю Либкаку</title>
     18<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     19<link rel="StyleSheet" href="caca-php.css" type="text/css" />
     20</head>
     21<body text="silver" bgcolor="black">
     22<?php
     23        ;
     24}
    425$pig_str = <<<EOT
    526                                   
     
    2445caca_set_color_ansi($canvas, CACA_BLUE, CACA_LIGHTGRAY);
    2546caca_put_str($canvas, 0, 0, "Я люблю Либкаку");
    26 echo caca_export_string($canvas, "utf8");
     47if (! $pngmode)
     48    echo caca_export_string($canvas, "html3");
    2749
    2850$font = caca_load_builtin_font("Monospace Bold 12");
     
    3557caca_render_canvas($canvas, $font, $img);
    3658
    37 imagepng($img, "out.png");
    38 echo "Please, open new created png file: out.png\n";
     59if ($pngmode)
     60    imagepng($img);
     61else
     62    echo 'Please, open <a href="?png=true">new created png file</a>.';
    3963
     64if (! $pngmode)
     65{
    4066?>
     67</body>
     68</html>
     69<?php
     70;
     71}
Note: See TracChangeset for help on using the changeset viewer.