我想使用似乎已安装但无法使用的 GD 库。
我看我的 gd 安装
php_info();
它返回给我:
然后我尝试了这个:
<pre>
<?php print_r(gd_info())?>
</pre>
这会返回:
Array
(
[GD Version] => bundled (2.0.34 compatible)
[FreeType Support] => 1
[FreeType Linkage] => with freetype
[T1Lib Support] => 1
[GIF Read Support] => 1
[GIF Create Support] => 1
[JPEG Support] => 1
[PNG Support] => 1
[WBMP Support] => 1
[XPM Support] =>
[XBM Support] => 1
[JIS-mapped Japanese Font Support] =>
)
但是当我尝试这样做时:
使用该代码:
<?php // content="text/plain; charset=utf-8"
$im = imagecreatetruecolor ( 300, 200);
$black = imagecolorallocate ($im, 0, 0, 0);
$lightgray = imagecolorallocate ($im, 230, 230, 230);
$darkgreen = imagecolorallocate ($im, 80, 140, 80);
$white = imagecolorallocate ($im, 255, 255, 255);
imagefilledrectangle ($im,0,0,299,199 ,$lightgray);
imagerectangle ($im,0,0,299,199,$black);
imagefilledellipse ($im,150,100,210,110,$white);
imagefilledellipse ($im,150,100,200,100,$darkgreen);
header ("Content-type: image/png");
imagepng ($im);
?>
它返回这个:
�PNG IHDR,�ݽK�IDATx������H���r,����p�CU�.!$Aw�ZB�h�].��ˀAM��O�5��D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�~F_����������7�)D��̎�s�"��po;,^�2?@�o�?���Y�N��覺�n~RM'������~�{���s� ��w� ���Z�\.їQƹ��&*ȍ�i�&��K��v��T�:>�����m�;K5.��}�u�#��T�W"�����nݫM����������K5���noOx�mr�Ǎpc~�;��GKq��䧽��R�8)���R��l��槽@Ok�;��#�_æ�s���h���p�@�%��bgv���1H��E�R���ZI����P~}�8�N"|T��:�(��N�T��8�G����Sx�oX=��P�#�l%�܄������k�Ò�P�\-�����b*�tX)B��z�e"T +JwX#B�T�D�@6*�a��K*v�=�{ d]� I��V��%���d^�y#T G�0i� ��*&�Ƒ1Bk���X�#��@��??�"LxPљl3�.���1�K>E�"�vDѫT��+��0 �lVbV���N��I�3)����f�E�V;lR,e� E�.#�I��A��ua{�a�bJO���Y���gR�b��f�G8�bf��7%����?h�����l�gR'��F�p�%Ŧ�Sm| �8��ƍp�1Ŧ���~p��f�Gx���&� ^z����]����Rlj������o&�e��8��}oU��W"|b_��� w�GL{�D�����fy�m��['���Te��6h�m$�C� ��鉾�����O�� ��A�4����N��b�M��t"|��I-���>@��8ͩ��[FZ����YN"�K3�(���P�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!�!����z�gt8IEND�B`�