$mysqli = new MySQLInterface(); // This is just a wrapper I wrote for the normal mysqli $query = "SELECT image_data ,image_size FROM image WHERE image_id = '".$id."'"; $result = $mysqli->Query($query); $imagedata = $result['image_data']; // Works with my wrapper $image = imagecreatefromstring($imagedata); $image_p = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); header('Content-Type: image/png'); imagepng($image_p);