简体   繁体   English

用PHP将彩色HTML格式的文本写入图像

[英]Writing colored HTML formatted text to an image in PHP

This is what I have so far. 到目前为止,这就是我所拥有的。

在此处输入图片说明

http://gyazo.com/3605597b9b8135f021c1c3481ff34acb.png?1329009331 http://gyazo.com/3605597b9b8135f021c1c3481ff34acb.png?1329009331

It successfully writes the source to the image, but I want it to render as HTML and then write the HTML formatted string to the image. 它成功地将源写入图像,但是我希望它以HTML呈现,然后将HTML格式化的字符串写入图像。

This is what I want it to look like, but in image form. 这就是我想要的样子,但是以图像形式。

在此处输入图片说明

http://gyazo.com/5afdb47793844f7648210ecd540da1c3.png?1329009540 http://gyazo.com/5afdb47793844f7648210ecd540da1c3.png?1329009540

Thanks for looking. 感谢您的光临。 I am so frustrated with this, haha. 我对此感到非常沮丧,哈哈。

I think there is only one way to print multi colored text by using the standard PHP GD and Image functios. 我认为只有一种方法可以使用标准的PHP GD和Image functios打印多色文本。 You must print it by having a seperate imagestring call for each color. 您必须通过对每种颜色单独调用imagestring来进行打印。

This works only for monospace font types, where all the characters having the same size. 这仅适用于等宽字体类型,其中所有字符均具有相同的大小。

If you want something "prettier" you must be using some other way. 如果您想要“更漂亮”的东西,则必须使用其他方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM