Jump to content

Image in database


johnnyk

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.
Link to comment
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
Link to comment
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?
Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.