您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

49 行
1.3 KiB

  1. <?php
  2. header('Content-Type: text/html; charset=UTF-8');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  7. <head>
  8. <title>Caca power!</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  10. <style type="text/css">
  11. </style>
  12. </head>
  13. <body>
  14. <?php
  15. /*
  16. * dithering.php sample program for libcaca php binding
  17. * Copyright (c) 2008 Nicolas Vion <nico@yojik.eu>
  18. *
  19. * This program is free software. It comes without any warranty, to
  20. * the extent permitted by applicable law. You can redistribute it
  21. * and/or modify it under the terms of the Do What The Fuck You Want
  22. * To Public License, Version 2, as published by Sam Hocevar. See
  23. * http://sam.zoy.org/wtfpl/COPYING for more details.
  24. */
  25. $src = "logo-caca.png";
  26. $img = imagecreatefrompng(dirname(__FILE__)."/".$src);
  27. if (!$img) {
  28. die("Can not open image.\n");
  29. }
  30. $dither = caca_create_dither($img);
  31. if (!$dither) {
  32. die("Can not create dither. Maybe you compiled caca-php without gd support.\n");
  33. }
  34. $canvas = caca_create_canvas(100, 40);
  35. caca_dither_bitmap($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img);
  36. echo caca_export_string($canvas, "html3");
  37. echo "<img src='./$src' alt=''/>";
  38. ?>
  39. </body>
  40. </html>