Posted June 18 '09 at 02:56 AM
Posts: 76
I've done this before just fine though it is only recommended with a LARGE amount of smaller images or in cases where you have or may have a lot of people editing images on your site (using gd or image magick).
For as to how you do it, you would load the $_POST['image'] dirrectly into the database same as you would if it was a text field except you have to run stripslashes() on the data first:
(ensure the data field is set to BINARY)
$query = ("INSERT INTO `table` (`id`,`name`,`binary`) VALUES (`" . $count . "`, `". $_POST['name'] ."`, `". stripslashes($_POST['image']) ."`)");
You would pull it out with a separate php file that sends the image header along with the echo from the binary field.