View unanswered posts | View active topics It is currently Wed May 08, 2024 11:46 am



Reply to topic  [ 6 posts ] 
Rendering or PEBKAC error 
Author Message
New pChart user
New pChart user

Joined: Tue Feb 08, 2011 11:20 pm
Posts: 3
Post Rendering or PEBKAC error
Hi, I saw you guys were actually pretty responsive in the forum! I am having an issue with rendering the chart.

I am doing a mysql query, thowing that data into an array, nothing special. I verified the arrays all have same length, no odd values etc.

When i attempt to render with autoput("test.png") the entire page breaks. Firefox says "The image 'asdf.php' cannot be displayed because it contains errors".

Iexplorer gives back some of the real text on the page then a big long PNG binary looking thing.

If i change to stroke() the rest of the page prints out except for the chart in both FF and IE


Wed Feb 09, 2011 5:35 am
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Rendering or PEBKAC error
Hi,

This can occurs if your PHP script send text (maybe space) before the picture data. Basically your script must start by the <?php tag and end by the ?> tag, no space, nothing more before and after.

JD.


Wed Feb 09, 2011 8:48 am
Profile WWW
New pChart user
New pChart user

Joined: Tue Feb 08, 2011 11:20 pm
Posts: 3
Post Re: Rendering or PEBKAC error
<?php
//get data from mysql
//do other page functions
?>

<?php
//all calls to plot,config,render data
?>

Would something like this work?


Wed Feb 09, 2011 9:51 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Rendering or PEBKAC error
No! Because PHP will send empty strings to the browser that will break the image data. You have to write all you code in a single <?php ?> block.

JD.


Thu Feb 10, 2011 12:47 am
Profile WWW
New pChart user
New pChart user

Joined: Tue Feb 08, 2011 11:20 pm
Posts: 3
Post Re: Rendering or PEBKAC error
im such an idiot....
<img src="chart.php">
im sorry!


Thu Feb 10, 2011 6:35 am
Profile
Regular pChart user
Regular pChart user

Joined: Sat Feb 19, 2011 1:00 am
Posts: 16
Post Re: Rendering or PEBKAC error
I ran into this when I was copying one of the examples to play with it.

I made a plain HTML page that contains one img tag, and that img tag's source is the php page that generates the PNG.

In other words the PHP does not generate any HTML, it generates only the PNG.


Wed Feb 23, 2011 11:30 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 10 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