Page 1 of 1
storing images in the database
Posted: Wed Aug 16, 2006 9:14 am
by GeXus
I'm sure this has been discussed a lot, I see alot of advantages to storing images in the database as a blob or longblob.. however I'm wondering how doing this would stack up on a site like flickr or myspace... vs. on the disk...
Does anyone have any insight as to whether this would be a good idea or not, also, when storing images in a db, can people save as on the images or would it just be a php file.. like img.php?id=5, is it posible to have it be an actual image xxx.jpg, etc.
Thanks!!
Re: storing images in the database
Posted: Wed Aug 16, 2006 9:19 am
by feyd
GeXus wrote:I'm sure this has been discussed a lot
Yes, it has been discussed a lot.
GeXus wrote:I see alot of advantages to storing images in the database as a blob or longblob
I see very very few advantages. Advantages that are far outweighed by the disadvantages in fact.
GeXus wrote:can people save as on the images or would it just be a php file..
Done right, the browser shouldn't notice a difference.
GeXus wrote:is it posible to have it be an actual image xxx.jpg, etc.
Yes.
Re: storing images in the database
Posted: Wed Aug 16, 2006 9:29 am
by GeXus
feyd wrote:GeXus wrote:I'm sure this has been discussed a lot
Yes, it has been discussed a lot.
GeXus wrote:I see alot of advantages to storing images in the database as a blob or longblob
I see very very few advantages. Advantages that are far outweighed by the disadvantages in fact.
GeXus wrote:can people save as on the images or would it just be a php file..
Done right, the browser shouldn't notice a difference.
GeXus wrote:is it posible to have it be an actual image xxx.jpg, etc.
Yes.
Well, I guess the advantages that I see are that all data will be stored in a central location, easy for backup, etc.. (not that its exactly hard to copy files)... it just seems a lot more organized.
My understanding is that while in a DB it will use resources, the same is true when doing disk writes all day long. you disagree?
Posted: Wed Aug 16, 2006 9:38 am
by feyd
With a database it will use nearly, if not, twice as many resources and system performance will suffer.
Why twice as many? When you request an image the database has to load it into memory, then php has to copy that memory into its memory.
Why will system performance suffer? You will need separate requests to the image display script for every image. PHP will have to load and run each of those requests separately too.
Posted: Wed Aug 16, 2006 10:08 am
by GeXus
Awsome, well that makes the decision easy.. thanks!