Re: [PHP4BETA] Enhancement Request

[email protected] (Alan) Wed, 31 May 2000 21:31:37 +1000
Newsgroups php.version4
Message-ID <[email protected]>
On Tue, 30 May 2000 23:02:57 -0700, Szii <[email protected]> wrote:
>
> Application: Pulling .jpg files out of a database into the in-memory file and
> then exported directly to the html.
>

HTML doesnt support this. The image tag specifies the url to the image, not the image 'data'

> Workarounds:
> 	1) Not putting image files in the database
> 	2) Export to a temp file and use <img src=x.jpg>
> 	3) Separate .php file using header(image/jpg)
>                 and use <img src=xxx.php?id=y>
>
> Just wishing for a "clean solution."  Best bet so far is just calling an
> external php file with ? params.  Wish I could just call one of my

option 2 IMHO is worse than not storing in the dtabase in the first place, when is the tempory image file going to be cleaned up ??

I've used the option 3 approach with great success, and not just for images.

> classes member methods to load/dump it instead of having to hack
> my way with external files.  1 4line snippet of code for a whole file
> gets kinda annoying.

where ever this code is put php will have to parse the whole file before the image is retrieved. 14 line file here is a good thing. 

>
> I can put it in the DB, get it out, but it's becoming a PITA to display it 
> properly.  Maybe someone can suggest a workaround?
>
> -Szii
>

Have a look at the <object> tag (html 4 specs) and inline data. Last time i looked the browsers didnt support rendering images like this, but maybe this has changed (fat chance though)
 

Regards,

Alan