Convert text to image?

后端 未结 5 1672
旧巷少年郎
旧巷少年郎 2020-12-08 17:58

I have seen in a couple of cases when sites generate image based on text/data input. How that can be achieved with PHP?

5条回答
  •  悲&欢浪女
    2020-12-08 18:41

    Working Solution:

    ( at first, you need to ensure, that the hosting has enabled GD library: in any php file, execute phpinfo(); and in output check if GD library is enabled) .

    Solution 1 (auto-sized output):

    TextToImage_my( $text='Helloooo! my unicode words:  ǩ Ƥ Ў  ض ط  Ⴓ ');
        // ==== other parameters can be used too, see the function arguments below
    

    function code: text-to-image.php


    Solution 2 (manual-sized output):

    (needs to have manual width&height of output, longer strings are cut out)..

     
    

提交回复
热议问题