class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
$handle->image_text = $my_dynamic_text . "\nMy static text";
In order to retrieve some text in your form, add an input field, or a text area field. Sanitize the value in the field, and then use it in your code: