Image processing in functions.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger

    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?opti on=$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.

  • Garp

    #2
    Re: Image processing in functions.


    "Roger" <fspooner@ripne t.jj.ik> wrote in message
    news:hm3fc0drov sbqcp27jra5jidc 1jgrt6948@4ax.c om...[color=blue]
    > 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?opti on=$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.[/color]

    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


    Comment

    • Alvaro G Vicario

      #3
      Re: Image processing in functions.

      *** Roger wrote/escribió (Wed, 09 Jun 2004 23:52:46 +0100):[color=blue]
      > print "<img src=" . chr(34) . "image.php?opti on=$draw" . chr(34) . ">"[/color]
      [color=blue]
      > What I would like to do is incoporate all the code contained in
      > image.php into my main.php as a function.[/color]

      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
      }
      [color=blue]
      > 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.[/color]

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

      --
      --
      -- Álvaro G. Vicario - Burgos, Spain
      --

      Comment

      Working...