I own a few fanpages on facebook in which I post images containing funny text ( like the example below ). Across all the pages I use the same text but with different background images. The sizes of the background is always the same. Only the color changes. Since I have to save each picture with a different background individually, I am now trying to create a small script that allows me to store the creates text with different backgrounds as a jpg or png file. Here is how i imagine the process:
I would add text to a textarea which would be a part of a normal html form.
With javascript I would like to fit the text ( in fontsize, width and height ) within the white border of the sample below.
When the form gets submited the script should then run through a loop and save the text on each different background in a seperate folder.
Here is an example of what the output should look like
There are parts of my plan that i know how to figure out. But there are two things I am stuck with.
How can i adjust the text so that it fits within the white border of the sample image?
How can i create an image out of a background image and some text on top of that.
Does anybody have an idea on how to approach this? Or maybe even a fully working script I could use for that?