So right now I have some code that create one big image our of writing a bunch of individual images (GD PHP). 

As of right now I have to write the background...

```
imagefilledrectangle($comp, 20, 20, 760, $descriptionHeight+900, $grey);

```

Then write the text...

```
imagettftext($variable, $font, 0, 350, 105, $color, $type, "Location: $city, $state");

```

Problem is that there is a bunch of text to write and the background height will vary depending on if not there is text there to be written. I am keeping a dynamic Y axis variable so when all the text gets done writing I have the end point of the text.

Is there any way to write a bg after all the text as been written to the main image? If not is there an ideal solution out there to accomplish a dynamic background?

Any help or thoughts would be appreciated.

Thanks,