If you use imagestring(), then there's an x and y coordinate you can plug in:
int imagestring ( resource image, int font, int x, int y, string s, int col)
If you're using something like imagettftext(), it too has an x and a y coordinate you can specify:
array imagettftext ( resource image, int size, int angle, int x, int y, int color, string fontfile, string text)
where X = 200 and Y = 310
Although if you're max image size is only 300, and you try to place the text at 310, you won't see the text since the image size is only 300. You'll probably have to create a new image of 400x310 and then insert the desired image at 400x300, and then add text at 310 (which actually is still going to fall off the image - you'll want to do something like: Y = (font height - max image height - SomeExtraPadding)).