Looks like many people are having problem with the function imagerotate from the gd library on php.
It also looks like the php guys have made a fork of the gd library and included a heavily customised version of it in php. Our problem is, the Ubuntu guys decided to get rid of that imagerotate and some others for security reasons. Fair enough, but how do I make it work now??
Here is how I do it on my server.