Hi Banibrata.
I really don't think this is the place to discuss something like this.
Please use the main forum from here: http://www.phpclasses.org/discuss/
But to answer your question, you start by reading this:
de.php.net/manual/en/refs.utilspec.
...
After that you can create a class for handling inserting text, images, etc. I am sure that you can even find some examples here on phpclasses.org
Good luck, and if you need help I'll try to help you, but use the main forum, this forum is for TOTP class only