I'm trying to upload an image, change its size and then write the result to a MySQL database. Basic code:
// load original image
$image = imagecreatefromjpeg($file); // load original image
// create new image
$newImage = imagecreatetruecolor($newWidth, $newHeight);
// copy original to new, changing size
imagecopyresampled($newImage, $image, 0, 0, 0, 0, $newWidth, $newHeight,$origWidth, $origHeight);
// save new image in database (in a BLOB field)
mysql_query("UPDATE myTable SET Photo='" . mysql_escape_string($newImage) . "' WHERE keyField=2");
But nothing is stored. $newImage appears to be a valid image of the correct size. What am I failing to do?