The view layer is copied and pasted to
phpStudy2013 GD Support does not open the workaround
Phpstudyadmin Console-configuration file-php.ini
Find "Extension=php_gd2.dll", remove "Extension=php_gd2.dll" in front of ";", save
Phpstudyadmin console-MySQL service-restart
Phpstudyadmin Console-Apache service-restart
Problem solving
And then take action
<?php
Set the Content-type
Header (' Content-type:image/png charset=utf-8 ');
Create the image
$im = Imagecreatetruecolor (100, 100);
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, $white);
The text to draw
$text = ' 1231231231231 ';
Replace path by your own font path
$font = ' Arial.ttf ';
Add some shadow to the text
Imagettftext ($im, 0, one, one, $grey, $font, $text);
Add the text
Imagettftext ($im, 0, $black, $font, $text);
Using imagepng () results in clearer text compared with imagejpeg ()
Ob_clean ();
Imagepng ($im);
Imagedestroy ($im);
?>
!! If the report does not show write on Ob_clean (), if garbled removed BOM head (at that time did not know, did not try)
Or
<? Php
Create a new Image instance
$im = Imagecreatetruecolor (100, 100);
Set the background to white
Imagefilledrectangle ($im, 0, 0, 0xFFFFFF);
Write on an image
Imagestring ($im, 3, +, ' GD Library ', 0xffba00);
Output image to Browser
Header (' content-type:image/gif ');
Imagegif ($im);
Imagedestroy ($im);
?>
PHP Generation Verification Code reference PHP manual