View unanswered posts | View active topics It is currently Wed May 15, 2024 12:45 am



Reply to topic  [ 2 posts ] 
gibberish instead of an image 
Author Message
New pChart user
New pChart user

Joined: Tue Nov 29, 2011 12:02 am
Posts: 2
Post gibberish instead of an image
I'm a web developer looking at some new tools that will allow my clients to display better charts and graphs with a more dynamic capability. I'm evaluating the pChart package to achieve this goal, but I'm having issues with the image being displayed incorrectly.

What I end up with is the image being displayed as wall of gibberish text as displayed in the attached image. I'm assuming this is because there's some issue with a character encoding variable some where, maybe in the web server configuration, that isn't being set properly.

Any insight would be appreciated.

This is the file I'm using to create the graph called graphTest.php

Code:
<?php   
/* Include all the classes */
include($_SERVER['DOCUMENT_ROOT']."/scripts/php/pChart2.1.3/class/pDraw.class.php");
include($_SERVER['DOCUMENT_ROOT']."/scripts/php/pChart2.1.3/class/pImage.class.php");
include($_SERVER['DOCUMENT_ROOT']."/scripts/php/pChart2.1.3/class/pData.class.php");

/* Create your dataset object */
$myData = new pData();

/* Add data in your dataset */
$myData->addPoints(array(VOID,3,4,3,5));

/* Create a pChart object and associate your dataset */
$myPicture = new pImage(700,230,$myData);

/* Choose a nice font */
$myPicture->setFontProperties(array("FontName"=>$_SERVER['DOCUMENT_ROOT']."/scripts/php/pChart2.1.3/fonts/Forgotte.ttf","FontSize"=>11));

/* Define the boundaries of the graph area */
$myPicture->setGraphArea(60,40,670,190);

/* Draw the scale, keep everything automatic */
$myPicture->drawScale();

/* Draw the scale, keep everything automatic */
$myPicture->drawSplineChart();

/* Build the PNG file and send it to the web browser */
$myPicture->Stroke();
?>


Attachments:
pChart_issue_001.jpg
pChart_issue_001.jpg [ 150.04 KiB | Viewed 4678 times ]
Tue Nov 29, 2011 12:25 am
Profile
New pChart user
New pChart user

Joined: Tue Nov 29, 2011 12:02 am
Posts: 2
Post Re: gibberish instead of an image
I solved the issue.

I was using <?php include('graphTest.php'); ?> in my content area when I should have just used <img src="graphTest.php" />.


Tue Nov 29, 2011 5:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron