Image-With-Text 介绍
Image-With-Text
能使用户能够无比轻松呈现多个独立样式的文本块图像。你可以控制每个每个文本的颜色、字体、行高和大小。你也可以通过特定的相对于源图像的 X 和 Y
值来定位文本块。
示例代码:
<?PHP require '../vendor/autoload.PHP'; // Create image $image = new \NMC\ImageWithText\Image(dirname(__FILE__) . '/source.jpg'); // Add styled text to image $text1 = new \NMC\ImageWithText\Text('Thanks for using our image text PHP library!', 3, 25); $text1->align = 'left'; $text1->color = 'FFFFFF'; $text1->font = dirname(__FILE__) . '/Ubuntu-Medium.ttf'; $text1->lineHeight = 36; $text1->size = 24; $text1->startX = 40; $text1->startY = 40; $image->addText($text1); // Add another styled text to image $text2 = new \NMC\ImageWithText\Text('No, really, thanks!', 1, 30); $text2->align = 'left'; $text2->color = '000000'; $text2->font = dirname(__FILE__) . '/Ubuntu-Medium.ttf'; $text2->lineHeight = 20; $text2->size = 14; $text2->startX = 40; $text2->startY = 140; $image->addText($text2); // Render image $image->render(dirname(__FILE__) . '/destination.jpg');
Image-With-Text 官网
https://github.com/nmcteam/image-with-text
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。