Jump to content


Photo

Image in database


  • Please log in to reply
5 replies to this topic

#1 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 June 2006 - 02:53 AM

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.
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#2 Monkeymatt

Monkeymatt
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 26 June 2006 - 04:09 AM

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

#3 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 June 2006 - 05:08 AM

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?
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#4 d_barszczak

d_barszczak
  • Members
  • PipPipPip
  • Advanced Member
  • 188 posts
  • LocationBradford - UK

Posted 26 June 2006 - 08:52 AM

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.

When all else fails - Try reading the manual.

Integrated IT Systems Ltd


#5 johnnyk

johnnyk
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 26 June 2006 - 09:53 PM

But wouldn't it be easier to upload the actual image to the database? Isn't that what blob is for?
Rediscover the Web:
<a href="http://www.spreadfir...;t=219"></a><br />

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 June 2006 - 10:07 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users