$image = "vintdev.JPG"; // 原图
$thumbw = 50; // 期望的目标图宽
$thumbh = 50; // 期望的目标图高
$path = "image"; // 存放的路径
$text = "test"; // 打印的文字$imgstream = file_get_contents($image);
$im = imagecreatefromstring($imgstream);if(function_exists("imagecreatetruecolor"))
  $dim = imagecreatetruecolor($thumbw, $thumbh);
else
  $dim = imagecreate($thumbw, $thumbh);
imagecopyresized ($dim,$im,0,0,0,0,$thumbw,$thumbh,imagesx($im),imagesy($im));
$white = ImageColorAllocate($dim, 255,255,255);
imagestring($dim, 1, 1, 1, $text, $white);
imagejpeg ($im,"$path/$image");