Re: Including GD inside HTML code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Giragosian wrote:
On 11/1/07, Instruct ICC <instructicc@xxxxxxxxxxx> wrote:

Alberto García Gómez wrote:
I trying to include some image generate for a function that use GD.

eg.:

function myfunct(){
    [MY_CODE]
}

but when I call the function it generate me a lot of symbols, letters
and numbers but no image.
WHAT CAN I DO?

PS.: I actually usgin a iframe to create the iomage in another .php
page and place it using this tag.
Este correo ha sido enviado desde el Politécnico de Informática
"Carlos Marx" de Matanzas.
"La gran batalla se librará en el campo de las ideas"

Sounds like you are trying to output the actual file content of the
image in the HTML.
You should have a separate script generate the img and link to it with
your HTML
<img src="generate_image.php?img=someImage" />

Then in the script generate_image.php you create the image and pass it
back at that point.

Depending on what is in your myfunct(), you may also need to set a header
to let the browser know what type of content you are outputting.


But the header, say __header("Content-type: image/png");__ would go at the
top of generate_image.php, to stay with the example above,
no? Doesn't direct output from GD function calls, necessarily using a header
call of the correct type, prevent any other html output on that page?

David


It does not "prevent" other HTML output, but the browser will not read it as HTML, it will think that it is binary data in the format of the picture data instead.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux