On Mon, Mar 9, 2009 at 10:24 AM, Sashikanth Gurram <sashi34u@xxxxxx> wrote: > Nathan Nobbe wrote: >> >> >> On Mon, Mar 9, 2009 at 7:32 AM, Sashikanth Gurram <sashi34u@xxxxxx >> <mailto:sashi34u@xxxxxx>> wrote: >> >> Hi, >> >> Yes, the problem was solved, but It did not work fine when I used >> the same code in my larger file. Now it makes sense. >> >> >> right, just track down where you started sending the output, and remember >> if youre going to use header() calls in your scripts, that all of them must >> come before sending any of the standard content. >> >> Let me just repeat what you have said just to make sure that I did >> not misread you. >> So you say that the solution to this problem is to create another >> php file with the image fetching header and just write an img tag >> <img src="myimagescript.php?id=1234" /> in my original php file >> (with the html tags). >> >> >> what i explained in my first response is that youre mixing 2 different >> approaches, and it was unclear what you were going for exactly. if you want >> to have an image included in a page of html, then theres no need for the >> header() call (refer to my first response for the remaining details). there >> are however legitimate use cases for the use of header() & the >> aforementioned image methods, i think between mine and some of the other >> posts on this thread, its explained clearly. >> >> This is what I have understood. >> Regarding the point you have mentioned ( If you set the content >> type using header() to "image/jpeg", do not use HTML tags to >> display your image!), >> >> >> correct >> >> I definitely need the HTML tags, because this application works >> based on the user input. So unless there is not input through a >> html form, it wont work. >> >> >> right, then just configure your webserver such that you can first access >> the image directly via an http url, then integrate these links into your >> dynamic pages as i explained in my first response. > > Thanks a lot for all the patient replies. All the suggestions led me in a > positive direction. Finally, instead of using the header() in my main PHP > file (with HTML tags), I have used it in a secondary file and called it > using a tag<img src="imgtest.php">. It is working fine. But, the image I > need to display is also dynamic and needs a user input. So, is there any way > in which I can transfer a particular variable (the user input) from my main > php file (say A.php) to my secondary file containing the header () (say > B.php) Yes. Use the Query String of your image-producing PHP script to pass values. If you had an image tag like this: <img src="imagescript.php?id=1234" /> Then you could grab the value of $_GET['id'] in your PHP script and react accordingly. HTH, -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php