0

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�

Charles
  • 50,943
  • 13
  • 104
  • 142
Jake
  • 25,479
  • 31
  • 107
  • 168

1 Answers1

4

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
  • 92,731
  • 24
  • 156
  • 164