467,104 Members | 1,029 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

Image processing in functions.

I have script (main.php) that calls a secondary script (image.php)
that produces a graphic. The invocation in main.php is like this...

print "<img src=" . chr(34) . "image.php?option=$draw" . chr(34) . ">"

What I would like to do is incoporate all the code contained in
image.php into my main.php as a function. As it currently stands if I
do this, I get an error message saying that the headers already sent.
I've not quite got my head around this- any help would be gratefully
received.

Jul 17 '05 #1
  • viewed: 1729
Share:
2 Replies

"Roger" <fs******@ripnet.jj.ik> wrote in message
news:hm********************************@4ax.com...
I have script (main.php) that calls a secondary script (image.php)
that produces a graphic. The invocation in main.php is like this...

print "<img src=" . chr(34) . "image.php?option=$draw" . chr(34) . ">"

What I would like to do is incoporate all the code contained in
image.php into my main.php as a function. As it currently stands if I
do this, I get an error message saying that the headers already sent.
I've not quite got my head around this- any help would be gratefully
received.


Something in image.php is sending headers (most likely it'll be the
content-type for jpg or png or whatever) and so is main.php - without seeing
the output I can't determine what. If you tweak image.php so it produces a
file on the server but only returns the URL to it, you can link it out and
get all the page output produced by the main.php.

Garp
Jul 17 '05 #2
*** Roger wrote/escribió (Wed, 09 Jun 2004 23:52:46 +0100):
print "<img src=" . chr(34) . "image.php?option=$draw" . chr(34) . ">" What I would like to do is incoporate all the code contained in
image.php into my main.php as a function.
You mean that you want a script that can either output HTML or graphics,
don't you? It should be rather straightforward:

function graphic(){
// Print graphic
}

if($_GET['option']=='WHATEVER'){
graphic();
exit;
}else{
// Print HTML
}
As it currently stands if I do this, I get an error message saying that
the headers already sent. I've not quite got my head around this- any
help would be gratefully received.


You are probably mixing graphics and HTML in one single document.

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jef Driesen | last post: by
5 posts views Thread by Jigar Mehta | last post: by
10 posts views Thread by stonny | last post: by
1 post views Thread by stonny | last post: by
10 posts views Thread by Enrique Cruiz | last post: by
36 posts views Thread by vimal3271@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.