2
votes

I am trying to generate image with some text and I have wrote following code:

<?php
    // Set the content-type
    header('Content-Type: image/png');

    // Create the image
    $im = imagecreatetruecolor(400, 30);

    // Create some colors
    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);

    // The text to draw
    $text = '준수';
    // Replace path by your own font path
    $font = 'fonts/Walkway Black RevOblique.ttf';

    // Add the text
    imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

    // Using imagepng() results in clearer text compared with imagejpeg()
    imagepng($im);
    imagedestroy($im);
?>

Now when I add text with English characters it works but when I used Korean characters is not working and getting this image.

enter image description here

Any idea how to display Korean text?

Thanks

1

1 Answers

0
votes

Looks like Walkway Black RevOblique.ttf is not Korean font. Try to download and use Korean one.