Re: header-ache

From: Date: Thu, 25 Jan 2001 16:43:55 +0000
Subject: Re: header-ache
Groups: php.db 
Request: Send a blank email to php-db+get-6163@lists.php.net to get a copy of this message
Addressed to: "Leo Kuiper" <leo@koelwebdesign.nl> php-db@lists.php.net ** Reply to note from "Leo Kuiper" <leo@koelwebdesign.nl> 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

« previous php.db (#6163) next »