Page 1 of 1

Adding an image to a database table?

Posted: Thu Oct 26, 2006 10:58 pm
by cturner
Can someone please tell me what data type I should use to add an image to a database? Thanks in advance.

Re: Adding an image to a database table?

Posted: Thu Oct 26, 2006 11:02 pm
by Zoxive
cturner wrote:Can someone please tell me what data type I should use to add an image to a database? Thanks in advance.
Images in databases, are NOT recommended, and I'm pretty sure its Blob, if you still continue on with it...

-NSF

Posted: Thu Oct 26, 2006 11:04 pm
by nickvd
You would be better off storing the file somewhere on disk and just inserting the filename (or path and filename) into the database...

Posted: Thu Oct 26, 2006 11:05 pm
by cturner
Why aren't images in databases recommended? How can I show an image for each product when there are a lot of images to be displayed? I have tried BLOB and nothing is displaying.

Posted: Thu Oct 26, 2006 11:13 pm
by Zoxive
cturner wrote:Why aren't images in databases recommended? How can I show an image for each product when there are a lot of images to be displayed? I have tried BLOB and nothing is displaying.
Why? its been said many times, and instead of explaining again.....

viewtopic.php?t=46301&highlight=image+database
feyd wrote: But it is not recommended. Why? In order to display the image, you'll have to make a reference to a PHP script as the image. This reference will need to query and extract the binary data from the database server. This causes more server load than is necessary. Instead, it is often suggested to use the filesystem to store the files. That's what it's built for.

If you want to read previous threads on this, use the search *blob* as the keyword string (with the both asterix)
viewtopic.php?t=37077

-NSF

Posted: Thu Oct 26, 2006 11:26 pm
by cturner
What data type should I use to store a filename in a database?

Posted: Fri Oct 27, 2006 8:53 am
by emmbec
I sugest to store the name as a VARCHAR, you also need the TYPE (also as VARCHAR) and you may want to store the size as an INT.

Posted: Fri Oct 27, 2006 2:02 pm
by jftuga
Our software vendor has decided to store images inside the database. The 270,000 images consume 72 gigs. When this file changes, the whole file needs to be backed up and 3 days of backups are stored. If the vendor had decided to store images on the filesystem, then incremental backups would be much easier as the database would be much smaller in size. I hope this database file never get corrupted. :?

-John