SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Including a page with IMG Content type

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Posts
    54
    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
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    20,288
    Mentioned
    225 Post(s)
    Tagged
    3 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.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Try your hand at the new JavaScript Challenge!

    If you don't like getting your feet stuck in a bog, avoid Twitter BootsTrap.

  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
    54
    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
  •