图像上的文字

san*_*ers 0 php text image

是否有可能在php中的图像上动态放置文本?然后将其发送到rss Feed?

Gre*_*reg 6

是的,可以使用GD功能或ImageMagick功能,具体取决于服务器上安装的功能和您喜欢的功能.

使用GD它会是这样的:

<?php
$img = imagecreatefromjpeg('my.jpg');
$textColor = imagecolorallocate($img, 0, 0, 0); // black text

imagefttext($img, 13, 0, 105, 55, $textColor, './arial.ttf', 'Hello World');

// Output image to the browser
header('Content-Type: image/jpeg');
imagejpeg($img);

// Or save to file
imagejpeg($img, 'my-text.jpg');

imagedestroy($img);
?>
Run Code Online (Sandbox Code Playgroud)

编辑:

要将图像放入RSS源,您可以将其保存到文件中并将URL放入Feed中.