Reply to Re: photos stored in database or as files

Your name:

Reply:


Posted by K. on 06/11/07 09:44

Uzytkownik "Jerry Stuckle" <jstucklex@attglobal.net> napisal w wiadomosci
news:Ys6dnQhGOeFxXvTbnZ2dnUVZ_iydnZ2d@comcast.com...
> K. wrote:
>> Hello all!
>>
>> I have a question to you.
>>
>> I would like to create photo gallery.
>>
>> I wonder if I should store photos (uploaded by users) in database
>>
>> $data = file_get_contents($_FILES['photo']['tmp_name']);
>> $data = mysql_real_escape_string($data);
>> // Preparing data to be used in MySQL query
>>
>> mysql_query("INSERT INTO {$table}
>> SET ext='$ext', title='$title',
>> data='$data'");
>>
>> $msg = 'Success: image uploaded';
>>
>> or I should store uploaded photo files as files in the server folder?
>>
>> Few years ago in my previous work I worked in MS Access application, and
>> in my opinion storing photos in this database are not so good, becuase
>> uploaded
>> photo files stored in MS Access application, enlarged the database a few
>> times.
>> That`s why storing such files in database is not so relevant and the
>> better way
>> was to saved these files in the specified folder.
>> What about Mysql?
>>
>> Could you give me your opinions?
>> M.
>>
>>
>
> I store images in databases all the time. It works well. Sure, the files
> can get large - but no larger than the individual files put together are.
> In fact, the database is generally smaller than the sum of the files
> because the db can manage disk space more effectively.
>
> If you do a lot of adding and deleting in the database your files may
> become larger due to empty space, but databases are generally pretty good
> at reusing that space where possible. You just may need to compress the
> database occasionally if this occurs.
>
> Databases work well with huge numbers of images - they're made to handle
> large numbers of rows. File systems aren't. 100K rows to a database is
> nothing. But try to put that many files in one directory.
>

OK. Thank you for the efficient explanaition. I understood everything.
It is logic and now I will know what I should do during builidng the
database.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация