Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from alt.ascii-art, 2 Oct 2000.
FIGLet web interface [was: Kanie]

FIGLet web interface [was: Kanie]

In article <39D...@gtcom.net>, Krogg wrote:
>Veronica Karlsson wrote:
>> 
>> And *what* am I supposed to do with *that* garbage? I meant like this:
>> 
>> http://www.surfplaza.com/figlet/
>> 
>> I always use Figlet on the web! I don't have the quota to keep software
>> on my account. Either it's "on the system", on the web or I live without
>> it.
>> 
>Well,there aint much i can do about that........HOW many fonts
>are avalible on the typical figlet web-interface.

Mine has 17, but of course that's only a test setup.  The code, which
I wrote to show that accepting arbitrary strings to figletize can be
done safely, is in public domain if anyone wants to use it to set up a
proper figlet server:

#!/usr/bin/perl -w
use strict;
use CGI::Carp qw/fatalsToBrowser/;
use CGI qw/:all escapeHTML/;

my $figlet = '/home/i/l/iltzu/figlet22/figlet';
my $fonts = '/home/i/l/iltzu/figlet22/fonts';

#
# Read list of available fonts
#
opendir FONTS, $fonts
    or die "Can't open font directory: $!\n";

my %fonts;
@fonts{grep s/\.flf$// => readdir FONTS} = ();

closedir FONTS
    or die "Error closing font directory: $!\n";

#
# Check parameters
#
param(font => 'standard')
    unless exists $fonts{param('font') || ''};
param(width => 80)
    unless (param('width') || 0) > 0;

#
# Generate form
#
print(header(),
      start_html('FIGLet WWW Interface'),
      startform(),
      table(Tr(td('Text:'),
	       td({-colspan => 4},
		  textfield(-name => 'text',
			    -size => 60))),
	    Tr(td('Font:'),
	       td(popup_menu(-name => 'font',
			     -values => [sort keys %fonts])),
	       td('Screen width:'),
	       td(textfield(-name => 'width',
			    -size => 5)),
	       td({-align => 'right'},
		  submit(-value => 'FIGLetize!')))),
      endform());

#
# FIGLetize input
#
if (length (param('text') || '')) {
    my $pid = open FIGLET, "-|";
    die "Can't fork" unless defined $pid;
    exec($figlet,
	 -d => $fonts,
	 -f => scalar param('font'),
	 -w => scalar param('width'),
	 param('text')) unless $pid;
    
    print "<HR>\n<PRE>\n";
    while (<FIGLET>) {
	print escapeHTML($_);
    }
    print "</PRE>\n";
    close FIGLET
	or die "Error running FIGLet: $!\n";
}

print(end_html());

__END__

The test URL is http://www.sci.fi/~iltzu/cgi-bin/figlet.pl

Now that I think about it, there's no reason not to add ascflip.flf to
the list, since I already have it on the server.  Make that 18 fonts.
-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"And, should you resort to sticking a martini olive up their nose,
 implacable universal laws require that they'll _like_ that sort of
 thing."  -- Graydon in r.a.sf.c

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f996b,8e2232ed9439d38a
X-Google-Attributes: gidf996b,public
From: Ilmari Karonen <ilt...@sci.invalid>
Subject: FIGLet web interface [was: Kanie]
Date: 2000/10/02
Message-ID: <970...@itz.pp.sci.fi>#1/1
X-Deja-AN: 676630184
References: <39c...@news.jakinternet.co.uk> <39c8dd15$1...@news.jakinternet.co.uk> <39C...@hotmail.com> <jb8...@4ax.com> <39C...@hotmail.com> <39C...@gtcom.net> <39D...@hotmail.com> <39D...@gtcom.net> <39D...@hotmail.com> <39D...@gtcom.net> <39D...@hotmail.com> <39D...@gtcom.net>
X-Complaints-To: new...@saunalahti.fi
X-Trace: tron.sci.fi 970495457 16577 195.74.0.20 (2 Oct 2000 14:04:17 GMT)
Organization: (dis)Order of the Holy Spoon (or whatever)
User-Agent: postit.pl 0.05
Reply-To: Ilmari Karonen <use...@itz.pp.sci.fi>
NNTP-Posting-Date: 2 Oct 2000 14:04:17 GMT
Newsgroups: alt.ascii-art
About this message. This message was posted publicly to the newsgroup alt.ascii-art in 2000 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post