使用动态文本和动态大小填充多边形

I have no clue, whether there is almost an solution for my problem nor if it is at all possible to do solve this.

What I want to do: I have a picture of polygones. It's a abstract drawing of a persons. Something like this

Now I want to fill each polygon (dynamically) with text strings (containing names). The result should be the drawing with the various text snippets inside the polygones.

The text snippets will come from a database. The picture should generate dynamically and will be displayed on a website.

I have no clue if this is possible, which technology or library to use.

Would be very kind, if someone has an hint where to start the search or which keywords to use for searching. Perhaps there is already a library in php, javascript or else which does such things.

You can make use of the GD Library in PHP to do this.

Here is a simple example how you can write text on the image. [Yeah .. Dynamically]