You can write on an image using GD or Imagemagick. Imagemagick has more options and I think simpler to use but it is not installed with php and some people are paranoid about using it as it's an external program.

You will need to modify the values in imagettftext as the current values are hard coded in.

You will need to adjust the font size to make sure it fits and the position is a bit hit and miss unless you calculate the size of the text "bounding box" and do some other calculations to get the correct position on the image.

It all gets very complicated in GD but hopefuly you will only need to write the code once.

The problem is when length of text is big then it is going out of the box.

How can I make it fit on image.

I have attached expected image updated using photoshop.

Any idea?

Rubble
—
2014-02-17T08:02:14Z —
#9

Word wrapping might work but I would try these first:

// Set Text to Be Printed On Image
$text = "Experience is a hard teacher
because she gives the test
first, the lesson afterwards.
- Vernon Law";
or
// Set Text to Be Printed On Image
$text = "Experience is a hard teache\
because she gives the\
test first, the lesson afterwards.\
- Vernon Law";

edge82
—
2014-02-17T11:31:42Z —
#10

Hi Rubble,

Many thanks for update.It works fine now.

The next problem is how to split words so that they will fit the image on new lines.