Page 1 of 1

Interesting

PostPosted: Mon Jan 02, 2006 9:48 pm
by Void Main
Small things impress me:

Cool Site
Code: Select all
  ___ ___         __     __   _______         __       
 |   |   |.-----.|__|.--|  | |   |   |.---.-.|__|.-----.
 |   |   ||  _  ||  ||  _  | |       ||  _  ||  ||     |
  \_____/ |_____||__||_____| |__|_|__||___._||__||__|__|

PostPosted: Tue Jan 03, 2006 1:03 pm
by worker201
The page you linked to was generated by some sort of script.

I'd be interested in seeing that script...

PostPosted: Tue Jan 03, 2006 1:33 pm
by Void Main
Me too! Maybe we could figure out how to write our own. I can actually think of an easy way to do it although I'll bet there is a cooler way to do it than what I am thinking of.

PostPosted: Wed Jan 04, 2006 9:19 am
by ZiaTioN
I found a perl version called Figlet-CGI. I also found a debian command line package written in C here. The CGI version does not look like the one you found Void, but maybe they tweaked theirs a bit to display like it is.

Code: Select all
#!/usr/bin/perl -w
#Figlet-CGI 0.1 by Matthew Borowski
#(C)1999 WorldServe Consulting http://www.worldserve.net
#License: BSD
#Make sure to set the variables below
#
#use the CGI.pm object-oriented module
use strict;
use CGI;
my ($query, $text, $fontname, $fontpath, $maxfontname, $maxtext, $figlet, $fontnameext, @newtext);
#set your font path here (directory with your .flf files) with trailing slash
$fontpath = "/usr/local/share/figlet/";
#set the full path to figlet here
$figlet = "/usr/local/bin/figlet";
#set the maximum length of $fontname
$maxfontname = "30";
#set the maximum length of $text
$maxtext = "50";
#
#
#process the query (either GET or POST)
$query = new CGI;
#print the content-type out
print $query->header;

#make sure font is specified, else quit
unless ($query->param('fontname')){
   #print the starting html
   print $query->start_html("Figlet Error");
   print "<p>Sorry, you didn't select a fontname.\n";
   exit;
}
else {
   #set the text variable
   $fontname = $query->param('fontname');
   #escape out the single-quotes so we can enclose in single quote below
   $fontname =~ s:\':\'\\'\':g;
}
#if font is longer than $maxfontname characters, quit
if (length($query->param('fontname')) > $maxfontname){
   #print the starting html
   print $query->start_html("Figlet Error");
   print "<p>Sorry, your text is too long (longer than $maxfontname characters).\n";
   exit;
}
#if fontname doesn't end in .flf, then quit
$fontnameext = substr($fontname, -4);
unless ($fontnameext eq ".flf"){
   print $query->start_html("Figlet Error");
   print "<p>Sorry, your fontname does not end in .flf\n";
   exit;
}
#unless we can open the file, exit
unless(-r "$fontpath$fontname"){
   print $query->start_html("Figlet Error");
   print "<p>Invalid font. Cannot open $fontname.\n";
   exit;
}
   
#make sure text is specified, else quit
unless ($query->param('text')){
   #print the starting html
   print $query->start_html("Figlet Error");
   print "<p>Sorry, you didn't specify any text.\n";
   exit;
}
else {
   #set the text variable
   $text = $query->param('text');
   #escape out the single-quotes so we can enclose in single quote below
   $text =~ s:\':\'\\'\':g;
}
#if text is longer than $maxtext characters, quit
if (length($query->param('text')) > $maxtext){
   #print the starting html
   print $query->start_html("Figlet Error");
   print "<p>Sorry, your text is too long (longer than $maxtext characters).\n";
   exit;
}
#print the starting html
print $query->start_html("Figlet: $text");

#print the main part of the page
print <<END;

<h1>Figlet Results:</h1>
<p>Processing '$text' with font $fontname
<hr>
END

#newtext variable becomes the output of the figlet command
@newtext=`echo '$text' | $figlet -f '$fontpath$fontname'`;
#turn the < and > signs into proper HTML formatting (&lt; and &gt;)
s/</&lt;/g for @newtext;
s/>/&gt;/g for @newtext;

print "<p><pre>\n @newtext</pre>\n";
print "<hr>\n";

print "<p><font size=-1>Script $ENV{'SCRIPT_NAME'} requested with method $ENV{'REQUEST_METHOD'} by $ENV{'REMOTE_USER'} $ENV{'REMOTE_HOST'} ($ENV{'REMOTE_ADDR'}) with $ENV{'HTTP_USER_AGENT'}</font>\n";
print $query->end_html;

#END

PostPosted: Wed Jan 04, 2006 10:21 am
by Void Main
Found the source and some related stuff here:
http://www.netsw.org/graphic/ascii/

It seems to work pretty well. For some reason there was an erroneous character in figlet.c. Just delete the first character in that file and it will make.

PostPosted: Mon Jan 09, 2006 11:47 pm
by Void Main
Actually there is a project web site for this:

http://www.figlet.org/

And there was Dag/Dries RPM that I added a bunch of extra fonts to and fixed the license (they have it listed as GPL but it's Artistic). Here are the new RPMS:

http://voidmain.is-a-geek.net/files/RPMS/figlet/

A web page I just whipped up to enter text/font:
http://voidmain.is-a-geek.net/files/mis ... gfonts.php