php - How to store an image from memory in MySQL -
i'm trying upload image, change size , write result mysql database. basic code:
    // load original image $image = imagecreatefromjpeg($file); // load original image         // create new image $newimage = imagecreatetruecolor($newwidth, $newheight);      // copy original new, changing size imagecopyresampled($newimage, $image, 0, 0, 0, 0, $newwidth, $newheight,$origwidth, $origheight);      // save new image in database (in blob field) mysql_query("update mytable set photo='" . mysql_escape_string($newimage) . "' keyfield=2"); but nothing stored. $newimage appears valid image of correct size. failing do?
as @wayne said. suggest save image in file system , save file path in database
 here code copy image filesystem  
 $imagepath="c:/your/file/complete/path";  if(isset($_files["file"])){     move_uploaded_file($_files["file"]["tmp_name"], $imagepath);     mysql_query("update mytable set photo_path='" .$imagepath. "' keyfield=2");  } edit: if need save in db, check this detailed explanation