Ok I can get it to insert into the datbase. When I run this query to get it out:
$id = addslashes($_GET['id']);
$res = mysql_query("SELECT pic FROM group_pics WHERE group_id = '23'");
$data = mysql_fetch_row($res);
header('Content-Type: image/gif'); //this will need to be changed accordingly with the image type
echo stripslashes($data[0]); //the binary contents of the image
It doesn't display the image.
The query that inserts the image into the database is:
insert into group_pics (group_id, pic, type) values ('23' ,'GIF89aK\0K\0Ä\0\0ÌÌÌìììÖÖÖ™™™äää¾¾¾**ÃÃÃÜÜÜ¥¥¥áááéééÑÑÑÙÙÙ³³³ÉÉÉÎÎÎ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0!ù\0\0\0\0\0,\0\0\0\0K\0K\0\0ÿ Ždižhª®lë¾p,Ïtmßx®ï|ïÏŽEÈ@4~HQ„0lIßÒI @£;D•Ê8bqmuñÅiÅNF¤lc¢víMEÈgº“p—åõC|}0€‚ƒ.…z‡ˆ,ŠtŒ*o‘’(€Cv—,šW*B€^¢)€§+™zœ¬)¤o¦±\' Ÿh°¶(©bj¼+³iµÁ(gMÅÆ˜q̹p.nNË_ÈT¡*®U«}Ô\\Ú%ÃTÑroîïðîo»_aš÷MôX”øtúQüú¡!#\' À-–\0Ô”0‰Á…{î<„èŽ/ŠhÚ8Pà€Ž#ˆ$HR&Ïÿ˜œurˆH t!Óc@\0€S„@\0h\"\0(Ð00Dé\0p5ÀÀ¨ÑM°s†Ô<\0x³\0ÙŠ8ðëÒ¦khÅ:×€ <ÐjïRRuöÔ aÙ.(j@)Ó\0N¼ Ð\0è§Ÿ\0üL@h×8À©t€/\0“Õ6h[Ú*ÛµM€æÁ¬ ™eº()ÔÕMšÓ.éŸO‡È@§mÔrƒ{V¬Ö¡\'FûÇ1\\Ž©-3®y\0g\0’|†Ñ‚V±?8›Vqïã¥;\0ñøÌ¥õÅb\0üÄv‹Ù×cN\0À{KåBzVqEH4IçÀHiˆ„\0* @ -å#À\"@P×`$†:_ÈHXØø†79ê(Æ?Høøã:iLsÜlBd2\0ÄxU\0éÃ#|8© ”u°Ae“a‰–TTÙ%ƒL–±¥•€xYægŽY…F=´)𕑤˜s’Yç6ar™g8lÜég?thŸh¾¢§¡v\"êf‡F”¨?‹JX†“xZ)˜ŠO¡”]êèŸUàØB\0;', 'image/gif')
The actual php query to insert it is:
$imgStr = addslashes(file_get_contents($_FILES['userfile']['tmp_name']));
//$imgStr=addslashes(file_get_contents($imagePath));
$filetype = $_FILES['userfile']['type'];
#Store Image String to the database
$querypic="insert into group_pics (group_id, pic, type) values ('$groupid' ,'".$imgStr."', '$filetype')";
echo $querypic;
mysql_query($querypic) or die(mysql_error());
Does that look right? It tries to pull an image but just displays a blank 75X75 picture which is the size of the actual file. Almost have it.