longblob VS. real image

Ralph van den Berg's picture

I am planning to allow users of my website to upload images, but I don't want millions of pictures to fill up my storage space. I've read up on this, and I've found 2 options.

There is the option to store images directly into the database as a longblob, and the option to move the images into a directory and then store a pointer to it in the database.

I feel that storing longblobs gives me alot more control over what's going on. For example, I can limit the number of images to, say, 100. When the 101st image is uploaded, the first will be deleted. There might be a way to do this kind of thing if the images are stored in a directory, but from what I've heard that requires a lot of manual labor (don't like it).

My question is thus; what kind of disadvantages do I have, in terms of storage space and loading times, when storing images in a database as longblobs against storing them in a directory with pointers in the database?

After this has been resolved, I also need to find a good resizing function. I want the images to have a maximum size, meaning I want to make them smaller if they exceed a certain width or height, but leave them at the original size if they are below the limits.

I believe it's not too complicated to accomplish this, hope to hear some responses soon.

Ralph - RalphvandenBerg.com