Jump to content

Archived

This topic is now archived and is closed to further replies.

johnnyk

Image in database

Recommended Posts

So I'm storing an images in a database. At some point, I'm gonna need thumbnails of these images. So my questions is this:
Assuming speed and database size are of equal importance to me, would you suggest - 1. using PHP's image functions to create a thumbnail and insert it into the database or 2. only inserting the fullsize image into the database and then creating a thumbnail from a query of the fullsize.

In option 2, the page that's querying the fullsizes would be querying about 25 images.

Share this post


Link to post
Share on other sites
It would be significantly faster, and use less server resources to have the thumbnail in the database, although I am against putting images in databases at all. I have done it before, but it is buggy, and writing the images to a file is significantly faster while using no more space.

I would suggest moving away from images in databases if possible, but if you want to stay with images in databases, inserting a thumbnail into the database would most likely be significantly quicker while not taking too much extra space.

Monkeymatt

Share this post


Link to post
Share on other sites
So do you think I should put the image filename in the database along with the info that goes along with the image (title and category and what not)? I googled and people were talking about that. I guess it would work pretty well.

But just out of curiosity, what's so bad about uploading a file to a database? Isn't that what blob is for?

Share this post


Link to post
Share on other sites
I designed an app for my workplace that showed a thumbnail of an image on the home page and a full size image with a description once it was clicked on and i just inserted the filenames into the database with the relevent information and stored my images in a folder.

Share this post


Link to post
Share on other sites
But wouldn't it be easier to upload the actual image to the database? Isn't that what blob is for?

Share this post


Link to post
Share on other sites
It seems that the latest and greatest use for databases is storing large amounts of binary data, known as BLOB's. These BLOB's can store just about any type of data imaginable, including MS Word documents, GIF/JPEG images, PDF files, MP3's, etc. In this article Mitchell shows us how to create a binary file repository using PHP and MySQL that can store and retrieve several different file types.It seems that the latest and greatest use for databases is storing large amounts of binary data, known as BLOB's. These BLOB's (Binary Large Objects) can store just about any type of data imaginable, including MS Word documents, GIF/JPEG images, PDF files, MP3's, etc.



As advised as above the filename of the img is faster and less space ok.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.