Image processing in functions.

This is a discussion on Image processing in functions. within the PHP Language forums, part of the PHP Programming Forums category; I have script (main.php) that calls a secondary script (image.php) that produces a graphic. The invocation in main....


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-10-2004
Roger
 
Posts: n/a
Default 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.

Reply With Quote
  #2 (permalink)  
Old 06-10-2004
Garp
 
Posts: n/a
Default Re: Image processing in functions.


"Roger" <fspooner@ripnet.jj.ik> wrote in message
news:hm3fc0drovsbqcp27jra5jidc1jgrt6948@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


Reply With Quote
  #3 (permalink)  
Old 06-10-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: Image processing in functions.

*** 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
--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:25 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0