problem in creating image

[font=Arial]hiii friends…i am getting a problem in creating image in php
here is my code for creating the image.can u help me in this plz.

$image=imagecreate(200, 200);
$cwhite=imagecolorallocate($image, 255, 255, 255);
$cblack=imagecolorallocate($image, 0, 0, 0);
$ccolor=imagecolorallocate($image, 138, 197, 255);
imagefill($image, 0, 0, $ccolor);

the problem is my output.i am not getting the output properly but i a getting the o/p as just like this

GIF87a�������������������,������������������ڋ�޼���H�扦�ʶ���L������� �Ģ�L�̦� �J�Ԫ��j�ܮ�����N���� ����������(8HXhx��������)9IYiy�������� :JZjz�������� e+;K[k{��������,N^n~��������/?O_o��������0��<�0�

can u plz explain the reason[/font]

[font=Arial]one more thing is my gd support setting is also enabled.still i am getting the problem[/font]

Your image seem to be created properly, but browser does not recognize it is image, because extension is .php
You need to add this line in your code, somewhere above the imagegif() function:

header(“Content-Type: image/gif”);

Sponsor our Newsletter | Privacy Policy | Terms of Service