0
我已经设置HBase并尝试使用Thrift-Php上传图像并显示它。我有一个列族命名的信息一个表,并使用类似:使用Thrift和Php在HBase中上传,回放和显示图像
$tmpName=$_FILES["file"]["tmp_name"];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);
fclose($fp);
try {
$mutations = array(
new Mutation(array(
'column' => 'info:pic',
'value' => $data
)),
);
$client->mutateRow($t, $username, $mutations);
} catch (IOError $e) {
echo("expected error: {$e->message}\n");
}
这似乎是工作,因为它存储在HBase的东西,然后
$arr = $client->getRow($t, $username);
foreach ($arr as $k=>$TRowResult ) {
$values = $TRowResult->columns;
asort($values);
foreach ($values as $k=>$v) {
$usr= $v->value;
$content=$_GET['username'];
header('Content-type: image/jpg');
echo $usr;
}
}
,但我得到的错误消息说图像包含错误。有人可以在Php中提供示例吗? 谢谢。