You can post the image to a page, and there make an image with the gd function make_image_from (or something like that) after that you put the text in with one of the GD textfunctions and in the end you insert the image as a blob in a database for instance.