On Wed, Jun 21, 2000 at 05:31:12PM +0300, sinisa@stripped wrote:
> Instead of storing images in arrays, why don't you just shoot them out
> one after another with WWW page ?? Just like in that C++ example ...
>
> Then no memory will be consumed.
To clarify this point (or drive it home, whatever), when your program
prints out the image data, it can print *only* image data. The
Content-type: header will be image/jpeg (or /png or whatever), and
you can't anything else. So you will first print out HTML like this:
<html>
.
.
.
<!-- you will have 8 of these, each with a different img_id -->
<table border="0">
<tr><td><img src="/your-script?img_id=12321" width="300" height="149"
alt="You are stupid if you don't buy this item."></td></tr>
<tr><td>This is the item's description.</td></tr>
</table>
.
.
.
Then, your script checks to see what the img_id is, and fetches *only
that one image* from the database and prints it immediately. As soon
as it's done printing it, it quits - so it's not storing anything in
memory longer than it's needed.
Still, I would just store the images on disk and let the web server
worry about it. Less work, and will probably be better.
Tim
--
Tim Smith < tim@stripped > :MySQL Development Team: Boone, NC USA.