You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 rivejä
1.2 KiB

  1. #!/usr/bin/php5
  2. <?
  3. $pig_str = <<<EOT
  4. _._ _..._ .-', _.._(`))
  5. '-. ` ' /-._.-' ',/
  6. ) \ '.
  7. / _ _ | \
  8. | a a / PHP |
  9. \ .-. ;
  10. '-('' ).-' ,' ;
  11. '-; | .'
  12. \ \ /
  13. | 7 .__ _.-\ \
  14. | | | ``/ /` /
  15. jgs /,_| | /,_/ /
  16. /,_/ '`-'
  17. EOT;
  18. $canvas = caca_create_canvas(0, 0);
  19. caca_set_color_ansi($canvas, CACA_RED, CACA_WHITE);
  20. caca_import_string($canvas, $pig_str, "text");
  21. caca_set_color_ansi($canvas, CACA_BLUE, CACA_LIGHTGRAY);
  22. caca_put_str($canvas, 0, 0, "Я люблю Либкаку");
  23. echo caca_export_string($canvas, "utf8");
  24. $font = caca_load_builtin_font("Monospace Bold 12");
  25. $width = caca_get_canvas_width($canvas) * caca_get_font_width($font);
  26. $height = caca_get_canvas_height($canvas) * caca_get_font_height($font);
  27. $img = imagecreatetruecolor($width, $height);
  28. caca_render_canvas($canvas, $font, $img);
  29. imagepng($img, "out.png");
  30. echo "Please, open new created png file: out.png\n";
  31. ?>