I need a piece of code to be used in a seperate script that renders text on a given image within a given rectangle.
Rendering should consider:
- adjusting font size to make the text fit into the rectangle
- handling of forced line wraps
- different formats (bold, italic) or even fonts on words or lines
- first car optional capitalized
- handle different colors
- render text on image (background) which is given by filename
- save to image with given file name.
commands for the format instructions might be defined by you.
The script will only run on local server and output should not be delivered in real time. Thus quality of rendering is important, not optimizing for some milliseconds.
The images will be usually something between 403x403 and 600x400 px
The code will be used in a PHP script. ImageMagick and GDlib are available.