tags:

views:

327

answers:

1

The call to Stroke() function in pChart renders an Image. When I try to display this image on the browser, it shows something like the following instead of showing an image. How can I display the image instead of these wierd characters?

�PNG  ��� IHDR����������h����tRNS������7X}�� �IDATx���wt[Y~'���C

H�Q�(�RV)TUW��v�}��cό�9�;g�xvv�;s��z����a�㝙 �v�cUu�����L�,Q)f��/��@E�� ���� ����.���{��W?"������P}�rW�������� !�����@�BB�����P�������T)$�������U !�����@�BB �����P�X˲�]������(!������RH������B��������������J!!������RH������ B��������������Jaaz������*�+�������U !�����@�BB�����P�������T)$�������U !�����@�BB �����P��!�����@�b˸������m����s��EA��0LE��^늧�2�

+1  A: 

If you are outputting the image directly from a call to a PHP script, such as <img src="yourscript.php" /> then you're going to need to send the correct Content-Type header:

header('Content-Length: '.filesize($yourimage));
header('Content-Type: image/png');

Note that any calls to header() must occur before output is started.

zombat