So, I was trying to make a set of Moo cards, using the MOO API, as part of The Guardian’s first ever Hack Day. It’s very easy and fun to use, and I enjoyed the learning process of formatting the images and data and submitting the constructed XML to MOO to print the cards. But…
But, the formats available from MOO are quite restrictive. This is understandable, as they want to retain some control over quality and their own branding, which is held in high esteem. For example, you can only ever put an image on the front of the card, and text on the back. I wanted image and text on the front.
I was using PHP to create the XML to postto MOO, so now I needed to learn how to use ImageMagick to merge some text into the image I was using. Unfortunately I’m not a command line geek, so I tend to get stuck when someone tells me to compile PHP. Luckily, someone was on hand to help me install GD, which is considerably easier to use.
I used GD to merge text into the image using imagestring. But I wasn’t able to successfully specify the fonts to use – every image was rendered with the default system font. GD wouldn’t work. Then I tried using imagettftext. This resulted in a blank page. I was using GD 2.3.5 on PHP 5. Eventually I found a link which explains a problem with Apple’s default implementation of Freetype in GD that crashes GD if you try and specify a font.
The result? I installed Macports, and updated PHP and Apache that way, resulting in a new install with GD 2.3.7
And it’s all working now! Now I’ve gone over the problems, I’ll post a bit more about actually creating the cards next.