Re: SQL Graphics

From: Date: Thu, 10 Aug 2000 04:42:32 +0000
Subject: Re: SQL Graphics
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1922@lists.php.net to get a copy of this message
>I am am using MySQL to store graphic images as blob types. >I then send them out to the web browser using the header >function to display them. The problem is I have to use >the header function as the very first thing sent to the >browser. I can't display additional images after the >first one because they get ignored. Is there another way >to output image (gif,jpg,png) raw data? I think there's some misunderstanding here - you can't send multiple images. When you generate HTML that includes something like <IMG SRC="images.php?ID=5"> the browser will make a single request for a single file. If you have <IMG SRC="images.php?ID=6"> the browser will make a completely separate request for it. The answer, of course, is to break out your images into a separate table. You could have something as simple as a row which contains the image idea and a blob holding the image, or perhaps something a little more advanced: ID INTEGER AUTO_INCREMENT, Mime VARCHAR(64), ImageData BLOB A simple PHP script could return the appropriate headers and data for a given image ID. Your master page would generate references to images, which would then be loaded one at a time.

« previous php.db (#1922) next »