I am trying to开发者_如何学C get it to show text1 and text2 on the same image only Text1 is showing up
$rImg = ImageCreateFromJPEG("test.jpg");
$cor = imagecolorallocate($rImg, 0, 0, 0);
imagestring($rImg,5,126,22,"Text1",$cor);
imagestring($rImg,5,500,34,"Text2",$cor);
header('Content-type: image/jpeg');
imagejpeg($rImg,NULL,100);
Thank you
(500,34) seems like a co-ord that is too far right. Unless the jpg is at least that wide, you won't see it.
You code works when I test it. The second argument to imagestring is a font identifier (I originally thought it was x-coord). Is your test image > 500 pixels wide?
This works great:
$rImg = ImageCreateFromJPEG("test.jpg");
$cor = imagecolorallocate($rImg, 0, 0, 0);
imagestring($rImg,5,0,0,"Text1",$cor);
imagestring($rImg,5,0,30,"Text2",$cor);
header('Content-type: image/jpeg');
imagejpeg($rImg,NULL,100);
精彩评论