Its ok to store image sized files into mysql isn't it?

Hi,

Can I assume for a web app with low number of users it’s OK to store
image
files in the mysql database? Makes it easy to setup/back etc then.
Perhaps this is how the plugins like upload_fu work (i.e. upload
straight to
the database?).

Can I assume for a web app with low number of users it’s OK to store
image
files in the mysql database? Makes it easy to setup/back etc then.
Perhaps this is how the plugins like upload_fu work (i.e. upload
straight to
the database?).

Sure it’s okay. You just want to run some numbers first to make sure
you won’t run out of room and your DBA won’t get upset that his
database is getting too big, etc.

I’d also suggest caching the results of your image generation action
to disk so you don’t hammer on Rails unnecessarily.

-philip

One distinct advantage of storing the image in the database is when
you outgrow one server box and need to run instances on several boxes.
A file based storage mechanism would have to somehow serve the images
to multiple boxes. As for me, if the image data is relatively small
(like thumbnails or avatars) I think storing them in the database is
convenient.

However, when I do this I put the image data into a separate table
(like pictures) so that I can easily restrict the fetch of the image.
You don’t want to be fetching all that binary data just to get a list
of people, for example. Then on your view when you show an individual
user, then go get the image from the pictures table for that user.

There are, however, other ways to do this, but you just have to decide
if you need to take that extra effort to keep your images out of the
database.

I’d also suggest caching the results of your image generation action
to disk so you don’t hammer on Rails unnecessarily.

Or maybe even memcached possibly?