there is a php code to create a user defined text with specified font ( .ttf or .opf formats ) where it have a background image? i want to achieve a result like this sample ( creating the image dinamically with php )

there is a php code to create a user defined text with specified font ( .ttf or .opf formats ) where it have a background image? i want to achieve a result like this sample ( creating the image dinamically with php )

currently css can't do this without tricks and 100% cross-browser, the good alternative is svg
Provided you want to do it in PHP, not CSS (guessing from the question tags), you have two options:
gd2 library.ImageMagick library.While there might be code on the Internet that does the thing you asked for, most likely, they'll be essentially using either of these two libraries internally. Using these libraries yourself will enable you to create an image you exactly want.
The difference between these is that ImageMagick supports more formats and features at the expense of being less portable, while GD is installed on most systems, but it supports only JPG/PNG/GIF formats and provides few features.
I know this is an old question, but for those looking for something similar with GD... you have to deal with masks.
Like in this question:
PHP GD Use one image to mask another image, including transparency
The only difference is that the mask image will be built using type, by you, writing white on black (or black on white).
So you will need
Steps:
copy foreground image to target image applying mask image as mask
output target image with correct mime type or save to disk