Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7928225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:40:54+00:00 2026-06-03T19:40:54+00:00

The problem is that the JpGraph is not displayed correctly on my web-page. The

  • 0

The problem is that the JpGraph is not displayed correctly on my web-page. The strange thing is that if I run the above code in isolation, then it works. But if I insert it in my main code, it fails producing the above-shown message.
P.S. I’m using ‘ob_start();’, but it does not solve the problem.

// A new graph with automatic size
$graph = new GanttGraph (0,0, "auto");

//  A new activity on row '0'
$activity = new GanttBar (0,"Project", "2001-12-21", "2002-02-20");
$graph->Add( $activity);

// Display the Gantt chart
$graph->Stroke();
?> 
</div>

JpGraph Error: HTTP headers have already been sent.
Caused by output from file index.php at line 85.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).

Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening "<?php".
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:40:55+00:00Added an answer on June 3, 2026 at 7:40 pm

    JpGraphs can’t exist in files with html. They have to be in a pure php file. To get around this, I created a seperate file that generates the graph, and made the whole thing a function. At the end, change

    $graph->Stroke();
    

    to

    $graph->Stroke(".<filepaht>.jpg");
    

    Then, in your index.php page, reference the image file.

    So, what it looks like you need is,

    createjpgraph.php:

    <?php 
    function GenGraph (<input variables>) {
    
        // A new graph with automatic size        
        $graph = new GanttGraph (0,0, "auto");        
    
        //  A new activity on row '0'        
        $activity = new GanttBar (0,"Project", "2001-12-21", "2002-02-20");        
        $graph->Add( $activity);        
    
        // Display the Gantt chart        
        $graph->Stroke("./foler/file.jpg");
    }
    ?> 
    

    index.php:

    ...
    <div>
    ...
    <?php
    include 'createjpgraph.php';
    GenerateGraph(<variables>);
    ?>
    <img src=\"./folder/file.jpg\" />
    </div>
    

    Hope this works for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Strange problem that just starting to happen on a SL/WCF RIA Services project that
One problem that I have frequently run into lately is the problem of my
I have problem that in my MVC 3 project, the logon view do not
There is a common problem that F# does not natively support infix-style use of
I am facing a problem that when I submit the page (form) the submission
The problem that I'm having is when running my android app, if I run
My problem is that I am trying to run a problem that I coded
I have a problem that when a person logs in then he should be
Simple problem that I can't figure out... How can I print a '%' character
The problem that I have is somehow very specific. I have to implement a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.