Php 文字到图像的转换方式很好-自动打断长线,字体也很好

Php 文字到图像的转换方式很好-自动打断长线,字体也很好,php,gd,Php,Gd,我正在将文本转换为图像,以便用户可以直接在Facebook和Twitter上分享报价。 我想用PHPGD制作图像。我有这段代码,它工作得很好,但它有一些问题,比如长行不能自动中断。此外,字体不工作,因为我想使用宇宙字体 这是我的密码 <?php header("Content-type: image/png"); $string = ' <p>I think the whole under-eye-bag thing is hereditary,

我正在将文本转换为图像,以便用户可以直接在Facebook和Twitter上分享报价。
我想用PHPGD制作图像。我有这段代码,它工作得很好,但它有一些问题,比如长行不能自动中断。此外,字体不工作,因为我想使用宇宙字体

这是我的密码

  <?php
     header("Content-type: image/png");


      $string = ' <p>I think the whole under-eye-bag thing is hereditary, and I just got lucky.</p> <p class="bq_fq_a"> <a id="qut" title="julianna_margulies"> Julianna Margulies </a> </p> <br>';

  $font  = '12';
       $fonttype = '/path/cosmic.TTF';

   $width  = imagefontwidth($font) * strlen($string);
    $height = imagefontheight($font);

   $image = imagecreatetruecolor ($width,$height);
    $white = imagecolorallocate ($image,255,255,255);
   $black = imagecolorallocate ($image,0,0,0);
    imagefill($image,0,0,$white);

  imagestring ($image,$font,0,0,$string,$black);

    imagepng ($image);
   imagedestroy($image);

      ?>


@AmalMurali如何?我正在将文本转换为图像,文本来自mysqlHi,您可以通过imagemagic获得此信息,请看这里现有脚本中的@jothikannan。我可以将这些更改设置为大图像吗