GD

Simple PHP Captcha

I came across this bit of code while I was looking for some reference material to help out a classmate with his PHP homework and thought I'd share.

All this does is generate a (basic) captcha image and check the user-inputed value. It's a good exercise for learning the GD library and some basic session stuff.

The code is split up in to two files: one for the HTML form, and the other for generating the image itself.

Tags:

Image to Text

So I've always wanted to make a script that read an image, and spat out ASCII art of that image. A few semesters back I wrote one, and I figured I'd share it here.
#!/usr/bin/perl -w

use strict;
use GD;

## Open the image, and get its size
my $src = GD::Image->newFromPng('src.png', 1)
	or die('Failed to open image: '.$!);
my ($swidth, $sheight) = $src->getBounds();

## Print out the html header
open OUT, '>out.html';
print OUT qq#<!doctype><html><head><title>ASCII Art</title>

Tags:

Subscribe to RSS - GD