[PHP] To store or not to store . . .

2002-04-24 Thread PHP List

Hi,
I was wondering about the following:
Should I store a picture directly in a MySQL table? Or just store the link
to a file on the system somewhere?

I would think that leaving the picture as an actual file and just storing
the link would be quicker. But what are the dis/advantages of storing right
in the table? I like the idea of not cluttering up my file system. Pictures
would only be about in the 20K range.

Thanks,
Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] To store or not to store . . .

2002-04-24 Thread John Holmes

Store a link to it. I see no advantage at all to storing binary data in
a database. It just creates a lot more work for you by putting the data
in a table. You have to create an interface to get at the data...or
select it out into a file to get back the image, etc. 

---John Holmes...

 -Original Message-
 From: PHP List [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 24, 2002 4:45 PM
 To: php
 Subject: [PHP] To store or not to store . . .
 
 Hi,
 I was wondering about the following:
 Should I store a picture directly in a MySQL table? Or just store the
link
 to a file on the system somewhere?
 
 I would think that leaving the picture as an actual file and just
storing
 the link would be quicker. But what are the dis/advantages of storing
 right
 in the table? I like the idea of not cluttering up my file system.
 Pictures
 would only be about in the 20K range.
 
 Thanks,
 Chris
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] To store or not to store . . .

2002-04-24 Thread Richard Archer

At 4:45 PM -0700 24/4/02, PHP List wrote:

I was wondering about the following:
Should I store a picture directly in a MySQL table? Or just store the link
to a file on the system somewhere?

This should be a FAQ.

If you allow people to upload files via a web form, your only secure
option is to store the images in a database.

In order to allow uploaded files to be stored in the file system
the upload directory must be writable by the web server process.

Anyone with access to PHP on the system can upload a script which
alters or deletes the files in this directory.

If the server is an ISP's server, you're giving access to these files
to every other client of the ISP.

If you are the only person with access to the PHP server, this may be a
valid option. And if you are 100% sure the code will never be required
to run under different circumstances.

Personally I think databases these days (MySQL in my experience at
least) are more than reliable enough and fast enough to serve up
binary data in quite large quantities. If you run into performance
issues, implement a caching solution run from a crontab.

 ...R.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] To store or not to store . . .

2002-04-24 Thread Maxim Maletsky \(PHPBeginner.com\)


 Personally I think databases these days (MySQL in my experience at
 least) are more than reliable enough and fast enough to serve up
 binary data in quite large quantities. If you run into performance
 issues, implement a caching solution run from a crontab.

I had a very, very bad experience with mySQL when a very simple table
(inserts at 99%) that got over 350.000 rows (100MB). So I wouldn't say
MySQL in my experience at least. As I migrated that barely-lost table
to postgreSQL (almost identical designs) it still goes on and currently
has over 1.000.000 rows (400MB)

Just my .002 EuroCents.

The rest on why to keep the images in Db is a very good answer.
Actually, it is so good that I might even write an article on this
issue.


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] To store or not to store . . .

2002-04-24 Thread Dennis Moore

If your page is frequently access and the data does not change then by all
means store the image in the file system.

however, I have found it useful to store the images in the database for
certain applications which I want to maintain an additional level of
security over the images when using sessions management.   For example, if I
want certain users access to certain images.  It is up to you to balance
performance with referential integrity and additional coding.



- Original Message -
From: PHP List [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Wednesday, April 24, 2002 7:45 PM
Subject: [PHP] To store or not to store . . .


 Hi,
 I was wondering about the following:
 Should I store a picture directly in a MySQL table? Or just store the link
 to a file on the system somewhere?

 I would think that leaving the picture as an actual file and just storing
 the link would be quicker. But what are the dis/advantages of storing
right
 in the table? I like the idea of not cluttering up my file system.
Pictures
 would only be about in the 20K range.

 Thanks,
 Chris


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php