Library tech blog

Thoughts and ideas on technology

Virtual library cards from Library Camp East

Wow, the library camp was such and inspiration. How did John Blyberg create the cards and how can I copy (copy=steal) this idea? I did not want to recreate his entire application but I did love the idea and was wanting to get my feet wet. So where to start. I downloaded and installed the GD.pm for perl. I then took a look at his blog and copied the jpeg of the blank card. Since I was using Unix I then used GIMP and converted it to a .png. I then wrote a simple script to see if I could write text to this image and then output it to another .png file.

#!/usr/bin/perl
############################################################
# Program : test.pl
# Programmer : Sean Robinson
# Description : Proof of concept on using GD.pm to write to a lib card
# Date : 9.26.2006
############################################################
use GD;

# create image object
$myImage = newFromPng GD::Image(‘card.png’);
$black = $myImage->colorClosest(0,0,0);

$myImage->string(gdLargeFont,100,10,”Library Camp East”,$black);
$myImage->string(gdSmallFont,100,35,”A place where people and idea meet”,$black);

$png_data = $myImage->png;

binmode(STDOUT);
print $png_data;

### End of code
At the shell prompt

#./test.pl > hold.png

This runs the program and outputs to hold.png

# display hold.png

This uses the program display to show the .png file

Card.pnghold.png

Ok no problem. The next step is to use the sirsi api to get the top 10 circulating books and create 10 library cards on the fly. That will have to wait for tomorrow.

September 27, 2006 - Posted by tscrobinson | Uncategorized | | No Comments Yet

No comments yet.

Leave a comment