Yes, that is possible. You would need to have the GD Library or Image Magick installed on the server machine in order to manipulate images using PHP.
You could start by just playing around with basic image manipulation - adding text to images with http://php.net/ImageTTFText
<?php
# just some ideas
# Connect to your db and pull out the text you want written to the image
# Set the enviroment variable for GD
putenv('GDFONTPATH=' . realpath('.'));
# Set the max dimensions for image
$max_width = "300";
$max_height = "400";
# Name the font to be used (note the lack of the .ttf extension)
# Note that the font should be in this directory relative to this doc
$font = "/fonts/vera";
$img_txt = "Text to be displayed";
$img = imagecreate($max_width, $max_height);
$green = imagecolorallocate($img, 0,128,0);
$yellow = imagecolorallocate($img, 255,255,0);
$gray = imagecolorallocate($img, 211,211,211);
$red = imagecolorallocate($img, 255,0,0);
$textwidth = $max_width;
$textheight;
$fontsize = 25;
while ( true ) {
$box = imageTTFbbox( $fontsize, 0, $font, $img_txt );
$textwidth = abs( $box[2] );
$textbodyheight = ( abs($box[7]) )-2;
if ( $textwidth < $max_width -20 )
break;
$fontsize--;
}
$pngXcenter = (int) ( $max_width/2 );
$pngYcenter = (int) ( $max_height/2 );
imageTTFtext( $img, $fontsize, 0,
(int) ($pngXcenter-($textwidth/2)),
(int) ($pngYcenter+(($textbodyheight)/2) ),
-$yellow, $font, $img_txt ); # Text Written To Center Of Image
# Write default text to image
$white = imagecolorallocate($img, 255,255,255);
ImageTTFText($img, 6, 0, 0, 10, -$white, $font, $img_txt); # Text in Top Left
# Display the image
header("Content-type: image/jpeg");
imagejpeg($img);
# Save the image
/*
imagejpeg($img, "$saved_manipulated_image", 100); # 100 % quality
*/
?>
Hope this little example helps you out in some way!