Jump to content

Header Already sent Problem For Images


aftabnaveed

Recommended Posts

Hi, Before listing my problem I would excuse for my English... because i am not a native english speaker
I am trying to read an image from the client side and read the contents of the images through

[COLOR=blue]
<?php
$picture =  $_FILES["picture"]["tmp_name"];
$fp = fopen($picture,"r");
$content = fread( $fp,filesize($picture) );
?>
[/COLOR]

Now I am trying to display Image inside a table like
  [COLOR=seagreen]<table>
    <tr>
        <td>[COLOR=red]<?php
            header("Content-type:image/jpeg");
            echo($content);
            ?>[/COLOR]
        </td>
    </tr>
  </table>[/COLOR]
When I try put the header("Content-type:image/jpeg"); line then it says that header already sent error message.

When I try to avoid this i use ob_start() and ob_flush() to display the image, but it only prints the URL from the address bar of the browser. But if I send header("Location:someotherpage.php"); It works well
So Is there any solution for this problem to display the Images header inside the html page
 
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.