Agreed....

I generally set aside a directory for any images, etc, per table, and
simply save any images as [primary_key].jpg. That way you can write
simple GetImage([table_name], [primary_key]) functions to return the
location/URL of the matching image.

regards,

P

On Fri, 23 Feb 2001, Mikel King wrote:

> Greetings,
> 
>     In most cases you will find that the storage of pictures and mp3's for
> instance are better left to the host fs rather than the dbs. Then you would
> only store the link to such files. Some will argue that this slows down access
> to the perticular file et cettera, blah blah blah...but generally most of us
> are creating web based apps that end up creating url's to said data anyway.
> 
>     Ok well that's my take on it.
> 
> cheers,
> mikel
> 
> Barry Radloff wrote:
> 
> > A blob is a nice field to use I guess
> >
> > see these attachements from when I asked the same Q...
> >
> > Some of them may or maynot be helpful..
> >
> > regards
> > Barry
> >
> > -----Original Message-----
> > From: Danie Weideman [mailto:[EMAIL PROTECTED]]
> > Sent: 23 February 2001 02:02
> > To: [EMAIL PROTECTED]
> > Subject: Saving pictures in MySql
> >
> > Hi everyone
> >
> > I am new to MySql and PHP
> >
> > I have downloaded and configured both
> >
> > I have just finished my first db and are on a high. I was quickly broad to
> > ground when I tried to load a image via a form into the database. Could
> > someone
> > please help with:
> >
> > What field type must be defined for pictures.
> > How to load and retreive pictures from a database using PHP
> >
> > Any thing more will be appreciated
> >
> > Kind Regards
> > Danie Weideman
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >   ------------------------------------------------------------------------
> >
> > Subject: RE: Binary data
> > Date: Wed, 31 Jan 2001 10:30:34 +0200
> > From: "Carsten H. Pedersen" <[EMAIL PROTECTED]>
> > To: Barry Radloff <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> >
> > > hi I am pretty new at this and would like to know how does one store a
> > > binary blob to the mysql DB ie I would like to store a jpeg to the db
> >
> > http://www.bitbybit.dk/mysqlfaq/faq.html#ch7_13_0
> >
> > http://www.bitbybit.dk/mysqlfaq/faq.html#ch14_1_0
> >
> > / Carsten
> > --
> > Carsten H. Pedersen
> > keeper and maintainer of the bitbybit.dk MySQL FAQ
> > http://www.bitbybit.dk/mysqlfaq
> >
> >   ------------------------------------------------------------------------
> >
> > Subject: RE: Binary data
> > Date: Wed, 31 Jan 2001 19:28:24 +0200
> > From: David Wilde <[EMAIL PROTECTED]>
> > To: Barry Radloff <[EMAIL PROTECTED]>, "'[EMAIL PROTECTED]'"
> >      <[EMAIL PROTECTED]>
> >
> > If your using PHP there is an article here on doing it with PHP3, it works
> > on 4 as well.  HTH
> >
> > http://www.phpbuilder.com/columns/florian19991014.php3
> >
> > Dave W.
> >
> >  -----Original Message-----
> > From:   Barry Radloff [mailto:[EMAIL PROTECTED]]
> > Sent:   Tuesday, January 30, 2001 10:56 PM
> > To:     '[EMAIL PROTECTED]'
> > Subject:        Binary data
> >
> > hi I am pretty new at this and would like to know how does one store a
> > binary blob to the mysql DB ie I would like to store a jpeg to the db
> >
> > Thanks
> >
> > Barry Radloff
> > R&D
> > Media24
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >   ------------------------------------------------------------------------
> >
> > Subject: Re: Binary data
> > Date: Thu, 1 Feb 2001 22:58:58 +0200
> > From: Peter Szekszardi <[EMAIL PROTECTED]>
> > To: Barry Radloff <[EMAIL PROTECTED]>
> > CC: [EMAIL PROTECTED]
> >
> > Hi Barry,
> >
> > I do not know what do you use for feeding your database, but in Perl you
> > shoud use the DBI module, and insert the binary data through bindings.
> >
> > use DBI;
> > use strict;
> >
> > ...
> >
> > my $dbh = DBI->connect("dbi:mysql:image_db", "user", "password") || die
> > "$DBI::errstr\n";                                       # connect to the
> > database
> >
> > ...
> >
> > my $sth = $dbh->prepare("INSERT jpeg_table SET size_x = $size_x, size_y =
> > $size_y, image_data = ?;") || die "$DBI::errstr\n";     # prepare the insert
> > statement, replacing the image data with a question mark
> > $sth->bind_param(1, $image_data);                       # binding the binary
> > data
> > $sth->execute() || die "$DBI::errstr\n";                # executing the
> > insert
> >
> > ...
> >
> > $dbh->disconnect();                                     # disconnect
> >
> > Regards,
> >
> > Peter Szekszardi
> > PortoLogic Ltd.
> > Portal building, design, net survey and more...
> >
> > On Wed, 31 Jan 2001, Barry Radloff wrote:
> >
> > >
> > >
> > > hi I am pretty new at this and would like to know how does one store a
> > > binary blob to the mysql DB ie I would like to store a jpeg to the db
> > >
> > > Thanks
> > >
> > > Barry Radloff
> > > R&D
> > > Media24
> > >
> >
> >   ------------------------------------------------------------------------
> >
> > Subject: Re: binary data
> > Date: Sun, 4 Feb 2001 08:26:57 +0200
> > From: Teddy A Jasin <[EMAIL PROTECTED]>
> > To: "Robert C. Paulsen Jr." <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> >
> > Hi okie heres a snippet of my php code:
> > the code below takes a file uploaded from the web with $file as declared
> > filename on
> > the form.
> >
> > if ($file_size>0) { //check whether the file is not empty
> > $data = addslashes(fread(fopen($file, "r"), filesize($file)));  //read the
> > file and
> > add neccessary quotes
> > $SQL="Insert into Files (Filename,Filetype,Filesize,data) values
> > ('$file_name','$file_type','$file_size','$data')"; //SQL commands to insert
> > into table
> > named 'FILES'
> > $result = mysql_query ($SQL)
> >         or die ("ERROR Uploading File:".mysql_errno().":
> > ".mysql_error()."<BR>$SQL");
> > }
> >
> > okie hope that helps!
> >
> > Teddy
> >
> > "Robert C. Paulsen Jr." wrote:
> >
> > > On Sat, Feb 03, 2001 at 10:20:07PM +0800, Teddy A Jasin wrote:
> > > > I have the scripts in php to do this if u want.
> > >
> > > Yes, that would help! thanks.
> > >
> > > >
> > > > "Robert C. Paulsen Jr." wrote:
> > > >
> > > > > How can I put binary data into a MySQL database?
> > > > >
> > > > > I assume the data type is blob, but I don't see how I can
> > > > > use SQL syntax to insert anything but text data. I would
> > > > > like to include various binary files (tar files, zip files,
> > > > > image files, etc.).
> > > > >
> > >
> > > --
> > > ____________________________________________________________________
> > > Robert Paulsen                                     [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >   ------------------------------------------------------------------------
> > ---------------------------------------------------------------------
> > 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
> 
> 


---------------------------------------------------------------------
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