List:General Discussion« Previous MessageNext Message »
From:Thomas Wana Date:August 8 1999 11:39am
Subject:Re: Storing/Retrieving a picture under MySQL for a website.
View as plain text  
Hello!

>Does anyone know of a way of storing a submitted JPG/GIF into a
>BLOB/MediumBLOB column, and then retreiving that picture out of the
>database, and displaying it on a webpage?.. Is this possible, or am I
>pipedreaming?...
>

You could use something of this sort:

Table 'image_table':
+--------+------------
| nr     | integer primary key not null
| length | integer

| image  | blob
+---------------------

You have to save the length of every image into 'length' and store 
the actual image data into 'image' (mysql_real_query, i think, because
of the binary data).

The program should look like this (pseudocode):

select length, image from image_table where nr=[number];
print "content-type: image/jpeg\n"
print "content-length: %ld\n",row->length
print row->image

I share the opinions of the others that this solution is not clean,
use file-name-references instead.

Regards
Thomas

Thread
Storing/Retrieving a picture under MySQL for a website.Richard Whittaker8 Aug
  • Re: Storing/Retrieving a picture under MySQL for a website.Rick Franchuk8 Aug
  • Re: Storing/Retrieving a picture under MySQL for a website.Thimble Smith8 Aug
Re: Storing/Retrieving a picture under MySQL for a website.Thomas Wana8 Aug