Yeah, the ImageMagick method I posted doesn't actually curve the text based on a path, it's more of a cheat/hack of the -wave command more than anything - That's why some of the characters are squashed a bit. If you alter the -wave attributes to something like -60x100 you'll see the actual wave effect which will shape the text into something that looks like a sine wave.
My idea for the GD method was to count the letters in the string and set up some variables to hold string length, height (in px), letter spacing (in px) and incline angle (in degrees) and then do a bit of maths to assign an angle and height value to each character - I guess there would be quite a bit of trial and error involved, especially with me as I'm crap at maths! It might be a bit easier to create the script that only positions each characters x and y position first, and once that's down, then modify it to add in the change in angle.