Page 1 of 1
how to insert images into mysql using php
Posted: Fri Dec 26, 2008 11:07 am
by kushaljutta
Hi everyone,
i need script about inserting images into mysql database useing php...
can anyone reply to me...
thanks in advance..
kushal
Re: how to insert images into mysql using php
Posted: Fri Dec 26, 2008 7:18 pm
by Andrewrun
I think you can read the image file using file_get_contents and then store it in a blob field in the database.
Then, to convert the blob back to an image, you can use
imagecreatefromstring.
Re: how to insert images into mysql using php
Posted: Fri Dec 26, 2008 11:27 pm
by watson516
You might want to think about just inserting a 'link' to the image and upload the image into a dir on the web server. When you need the image, use the link in an img tag or background or whatever you need. If you have to transfer the db to another server, you'll just have to copy over the image directory.
Re: how to insert images into mysql using php
Posted: Sat Dec 27, 2008 12:22 am
by requinix
watson516 wrote:You might want to think about just inserting a 'link' to the image and upload the image into a dir on the web server. When you need the image, use the link in an img tag or background or whatever you need. If you have to transfer the db to another server, you'll just have to copy over the image directory.
Totally agreed.
Putting images into a database may look cool and all but it's not worth it. Puts an even heavier load on the database because it's serving mere
images too.
Re: how to insert images into mysql using php
Posted: Sat Dec 27, 2008 2:14 am
by kushaljutta
thanks for ur suggestion....
just introduce urself with me
kushal.jutta@gmail.com
mail me...