More on topic for your post, would you not have considered using Image Magick in php? :)