If I were you I would not store a binary file into the database, I'd store
the information required to fetch it from somewhere else like the mySQL
manual suggests
----
Andrei Cojocaru
[EMAIL PROTECTED]
----- Original Message -----
From: "Sherzod B. Ruzmetov" <[EMAIL PROTECTED]>
To: "Sameer Maggon" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 12:26 AM
Subject: Re: store JPG in MySQL DB


>
> For real-life example, check out http://cdbaza.ultracgis.com, and check
> out the filename
> of the thumbnails images. I'm SELECTing those images from the MySQL
> database.
>
> That's how it's done:
>
> 1_ Create a table to store your JPGs, and the column that holds JPG data
>    should be declared as BLOB
>
> CREATE TABLE images (
> image_id INT UNSIGNED NOT NULL AUT_INCREMENT PRIMARY KEY,
> image BLOB NOT NULL
> );
>
>
>  2_ Now you are ready to load the JPG data into the image column.
>     I use Perl to open the JPG file and dump the contents into the table,
>     and the resulting query looks something like:
>
>     INSERT INTO images SET image="here goes contents of the JPG file";
>
>     Perl code that does this job would look like:
>
>     local ($/);
>     sysopen (JPG, "test.jpg", O_RDONLY) or die $!;
>     $dbh->do(qq|INSERT INTO images SET image=?|, undef, <JPG>);
>     close (JPG);
>
> Sorry if you don't know Perl, but you should be able to do similar
> thing in any other language you might be using
>
>
>
> Good luck!
>
> --
> Sherzod
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to