Addressed to: "Leo Kuiper" <[EMAIL PROTECTED]>
              [EMAIL PROTECTED]

** Reply to note from "Leo Kuiper" <[EMAIL PROTECTED]> Thu, 25 Jan 2001 13:06:53 
+0100
>
> Ok I'm kinda new to this list so I'm very sorry for those who've
> heard this question a million times.
>
> How to get binary data (jpg file?) AND text from a database, BUT
> display it on the same page? I know the header-content-type blocks
> all this (either display text or jpg), but there must be some way to
> do it, right?
>
> (can you use two types (text and jpg) in the header, and choose
> between them when you want? just a wild guess. or do I just have do
> it in a totally other way?)

1.  When you get the text out of the db, write the image to a temp
file, and send the name of the temp file in the <IMG> tag.  Be
sure to close the temp file before you send the html.  Don't forget to
garbage collect the temp files when you are done with them. You can't
do it in the program that creates them.


2.  Use two separate programs.  One gets the text, the other
masquerades as a .jpg file, and does another SELECT on the database and
returns the image.  You can call it like:

   <IMG src="getimage.php?show=1234">


3.  Don't bother putting the images in the database at all.  The web
server is designed to get images from the file system, and does it
well.


1 sucks, 2 is better, 3 is probably the best solution.




Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to