Core PHP
NFO Viewer v1.1
Core PHP
Blog: CorePHP Blog     Current Projects: PHP on XP Guide  —  NFO Viewer  —  Easy Reflections  —  HotWire  —  FileGlider

Updated 5th January 2008

NFO Viewer

NFO Viewer is a PHP script that will render an NFO file to a PNG image using a true font. The end result is a PNG file that is often smaller in size than the original NFO file itself, and presents them in a manner perfect for viewing online.

What the hell is an NFO file?!

If you need to ask then you almost certainly don't need to use this script. So please save my bandwidth and move on elsewhere :)

Aren't NFO files to do with software piracy?

Kind of, yes, although for a lot of people they also resemble works of art. The following extract from this Wikipedia page should help:

"NFO files usually contain release information about a software program. They are commonly associated with copyright infringement groups responsible for warez who include them to declare credit of and "bragging rights" over said release. Similarly they are often found in demoscene productions, where the respective groups include them for credits, contact details, and the software requirements.

NFO files were common, and sometimes required, during the era of the BBS. A typical warez NFO file was elaborate and highly decorated, and usually included a large ASCII art logo along with software release and warez group information. The designers of these NFO files frequently incorporated extended ASCII characters from the then near-ubiquitous code page 437 character set in the file."

Why did you write this?

While working on FileGlider, my PHP file indexing / viewing / downloading application, I wanted to include support for viewing different file types within it. NFO files are one such file type, and this is the viewer I wrote, extracted to run stand-alone. I figured there was no harm in releasing it - you never know who might benefit.

NFO Viewer Examples

Example NFO File:
Font Colour:








Background Colour:

Download NFO Viewer

NFO Viewer 1.1 Standard (66 KB)
Includes the source code and examples.

NFO Viewer 1.1 Full (181 KB)
As Standard but also includes the PSD font file.

Font Set Photoshop File (116 KB)
The Adobe Photoshop PSD file used to create the PNG that NFO Viewer uses. Edit this to create your own colour sets.

NFO Viewer was written and tested with PHP 4.4.5 and PHP 5.2.3. It is fully compatible with E_ALL and Register Globals Off. It requires that PHP has GD extension 2.0.1+ loaded.

Update 1.1 - 5th January 2008

The nfogen.php script has been updated to fix a couple of bugs. First the BG (background colour) parameter was not properly read, but now is. Secondly the directory the NFO files live in has been locked down and directory commands such as ../ no longer work. My thanks to Rolf Schellenberger for his email about this.

Can it display full colour ANSI artwork?

No. It was never designed for that. If that is what you need then the excellent ANSI Love is a set of PHP scripts that render full on ANSI artwork (and a whole lote more) in all its glory.

What parameters can I set?

You have 3 parameters available, only one of which is actually required.

Parameter Result
nfo
string

Required. This is the path and filename of the NFO file you wish to display. You can include directories, or directory commands, but not URLs.

Examples:

&nfo=trsi.nfo
&nfo=/files/nfo/damn.nfo
&nfo=../files/storm.nfo

colour
integer
0 to 9

Optional (defaults to 0).Which font colour should be used to render this NFO file? Values are 0 to 9. 0 = White. 1 = Green. 2 = Amber. 3 = White on Blue. 4 = Deep Red. 5 = Black on White. 6 = Silver. 7 = Gold. 8 = Rainbow. 9 = Blue. You can create more font colour variations by modifying the Photoshop PSD file and generating a new nfo_font.png.

Examples:

&color=6 (silver font)
&color=0 (white font)

bg
hex
#000000 to
#ffffff

Optional (defaults to black).The background colour to place the rendered font onto. The value should be given in hex (i.e. HTML style) and can be 3 or 6 characters in length. The hash (#) at the start is optional and on some PHP version will need to be excluded.

Examples:

&bg=#fff or &bg=#ffffff (white background)
&bg=#fb1717 (deep red colour background)

Cheers

Hope you find this script useful. Feel free to rip it apart, use chunks of it, re-write it, and generally use and abuse it at your leisure. If you have trouble with it, you can try emailing me, but my time is limited, so be sure to read this page carefully first. You are also welcome to post comments about this code on my related blog entry.

© Copyright 2007 - 2008, Richard Davey