MetaChat is an informal place for MeFites to touch base and post, discuss and
chatter about topics that may not belong on MetaFilter. Questions? Check the FAQ. Please note: This is important.
14 June 2007
AskMecha: Madlib / random headline generator?→[More:]
I've got a bunch of two-part fake headlines I want to combine randomly (at the click of a button) for my blog, like:
1
Man bites
Global warming caused by
Britons enraged by
2
Dog
Paris Hilton
Bush legacy
Etc. etc. The output needs to be a specific font (Capitolium) to match the typeface of the newspaper I'm trying to parody (de Volkskrant), so the output will probably be images (unless there's some magical way to do this in text).
Anyone got any ideas how to script this? Bunny wuv!
-it can be done without PHP
and
-the script allows for different n of the two categories (sentence parts), and "counts" how many items are in each category so I can add more at will without having to update the script.
Do you have the GD library on your server? (This is something that would run on your server, no?) What language are you hoping to write the script in, if not php?
No, but GD looks pretty neat (you can tell I'm quite pedestrian when it comes to these things, because I hadn't heard of GD before). It requires PHP though, no?
Basically I was hoping for something like JavaScript to do the trick, because I'm a PHP noob.
If you created each letter as an individual image, you could have javascript put them together for you to form the headline.
But if you're actually creating the headline image on the fly, it would probably have to be server-side. Interfaces to GD are available in several languages besides php.
Re: "magical way to do this in text" ... does anybody know the status of browser support for CSS embedded fonts?
Javascript alphabet sounds fine with me. Any clues as to how to code this up? The basic function should be trivial, but it needs to cope with the two-parter thing okay, and if the output could be overlaid on a generic newspaper front page that would be much spiffier.
For real? That would be awesome. I got the alphabet converted to images and tried to write a [$letter]-to-[$corresponding image] JS script for it, but I think I suck, because it doesn't work.
I'm at work now, but I'd gladly send you the relevant stuff when I get home.