Smarty:从html/php创建png图像

Smarty:从html/php创建png图像,php,html,image,smarty,smarty2,Php,Html,Image,Smarty,Smarty2,我正在使用Smarty构建一个带有拉引号的文章布局,使用webfonts设置样式。我想为电子邮件客户端创建一个并行布局,其中自动包含png版本的pull quote 有没有一种方法可以根据我用来格式化文章布局的拉引号的代码片段将png图像写入文件,就像我从Smarty模板编写html文件一样 这是我的代码片段: <p class="quote" style="width:720px; color: #ff0066;font-family: {$quotes.0.fontfamily};fo

我正在使用Smarty构建一个带有拉引号的文章布局,使用webfonts设置样式。我想为电子邮件客户端创建一个并行布局,其中自动包含png版本的pull quote

有没有一种方法可以根据我用来格式化文章布局的拉引号的代码片段将png图像写入文件,就像我从Smarty模板编写html文件一样

这是我的代码片段:

<p class="quote" style="width:720px; color: #ff0066;font-family: {$quotes.0.fontfamily};font-size: {$quotes.0.size}px;text-indent: -12px; margin: 0 20px 0.5em 20px;">{$quotes.0.quote}</p>

但很明显,事情并没有那么简单

HTML到图像并没有任何像样的解决方案——相反,使用PDF会更幸运。例如dompdf。好的,谢谢,明白了。另一种选择是,可以使用CSS样式与PHP解决方案(如此处所示)配合使用:您可以使用imagemagick生成pdf并将pdf转换为png。
// get output 
$output = $smarty->fetch('quote-image.tpl'); 
// write png image file
$file = $quotes["filename"].'.png';
file_put_contents($file,$output);