SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Including a page with IMG Content type

    Hello
    I am trying to create a dashboard on a php website which shows graphs.
    I can get the graphs to work on their own but when I try to mix in text or include the graph.php page in a regular php page, it doesnt work.
    Says headers were already sent. I have narrowed it down to "header("Content-type: image/png"); " being at the top of the page.

    HEre is my question.
    Lets say I have a page, "dashboard.php". I also have graph1.php, graph2.php and graph3.php.
    I want to include those into dashboard.php. How do I handle this. When I do it now it says : Cannot modify header information - headers already sent by ..." Obvioulsy because the included page (graph1.php) contains the header content type line.

    how to i fix this?!?

    Thanks in advance.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by xeonman13 View Post
    because the included page (graph1.php) contains the header content type line
    Have you tried removing that? You don't need those in an include file.

  3. #3
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    <img src='graph1.php' />

    Yes it's that simple

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks. never thought of doing an img src with anything besides an image file. this helps.

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •