johnnyk Posted June 26, 2006 Share Posted June 26, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12898-image-in-database/ Share on other sites More sharing options...
Monkeymatt Posted June 26, 2006 Share Posted June 26, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/12898-image-in-database/#findComment-49526 Share on other sites More sharing options...
johnnyk Posted June 26, 2006 Author Share Posted June 26, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/12898-image-in-database/#findComment-49531 Share on other sites More sharing options...
d_barszczak Posted June 26, 2006 Share Posted June 26, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12898-image-in-database/#findComment-49575 Share on other sites More sharing options...
johnnyk Posted June 26, 2006 Author Share Posted June 26, 2006 But wouldn't it be easier to upload the actual image to the database? Isn't that what blob is for? Quote Link to comment https://forums.phpfreaks.com/topic/12898-image-in-database/#findComment-49821 Share on other sites More sharing options...
redarrow Posted June 26, 2006 Share Posted June 26, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12898-image-in-database/#findComment-49825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.