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 8021439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:58:59+00:00 2026-06-04T21:58:59+00:00

do take alook at this link below.. http://www.7tech.co.in/php/how-to-generate-a-graph-image-in-php/ I am wondering, what does this

  • 0

do take alook at this link below..

http://www.7tech.co.in/php/how-to-generate-a-graph-image-in-php/

I am wondering, what does this code below means?

header("Content-type:image/png");
 imagepng($img);

When i try to implement this 2 lines, i will get error which said, “Cannot modify header information -headers already sent by…” And when i comment them, there is no error, but graph cannot be seen..

Hmm, does anyone know what it means, can care to explain to me? Sorry, i am very new to PHP.. Thanks in advance!

  • 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-04T21:59:01+00:00Added an answer on June 4, 2026 at 9:59 pm

    The error you’re receiving is informing you that you cannot change the response headers to image/png, because they’ve already be set and sent. Make sure the header() line is the very first line in your output. You cannot output anything before it.

    As for the second line, imagepng(), this is used for outputting a portable-network graphic. The $img variable would be the image resource that would have been built earlier. The following is an extremely basic example using both of these lines:

    <?php
    
      // Gets an image resource
      $im = imagecreatefrompng("test.png");
    
      // Tells the recipient we're sending image data
      header('Content-Type: image/png');
    
      // Output the PNG image data
      imagepng($im);
    
      // Cleanup
      imagedestroy($im);
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take a look at this image The source code in the link is jumbled.
Please take a look at the following link: http://www.nba.com/warriors/audiotrack_test_000005.html?mark-jackson-on-the-dan This works properly (meaning it
Take a look at this jsFiddle Code also listed below: window.MyView = Backbone.View.extend({ ticks:
Take a look at this page: http://pearl.tinderfields.com/ In IE6 the menu's background image loads
Take a look at this link http://dncminneapolis2012.com/new2 If you click on two, it slides
Take a look at this URL: http://download.mozilla.org/?product=firefox-9.0.1&os=win&lang=nl It is the direct link to download
Please take a look at this link: http://bethhaim.spin-demo.com/ I can't figure out why there
Take a look at this code: public class Test { public static void main(String...
take a look at this code: $(document).ready(function() { document.getElementById(sliderId).onmousedown = sliderMouseDown; }); function sliderMouseDown()
Take a look at this snazy plugin: http://remysharp.com/2007/12/28/jquery-tag-suggestion/ ** it's real small Source: http://remysharp.com/downloads/tag.js

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.