我有从( https://github.com/KeejOow/eidlib )使用的 eID 读卡器 SDK ,效果很好。
使用 SDK 它允许我读取我的身份证详细信息,但我需要读取图片,所以我使用 SDK 获得了这个哈希图片值。
Hash picture: *P¿xxxxxxxxx
代码:
public function removemeoncetestedAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
//$this->_response->setHeader('Access-Control-Allow-Origin', '*');
$this->db = Application_Model_Db::db_load();
$sql = "select *From idcard order by id desc limit 1";
$cresult = $this->db->fetchAll($sql);
if(count($cresult) > 0) {
$arr = explode("\n", $cresult[0]['card']);
$encodedPhoto = base64url_decode($arr[18]); // Hash picture
//header('Content-Type: image/jpeg');
echo "<img src='{$encodedPhoto}' />";
}
exit;
}
我怎样才能从这个哈希字段中得到真实的图片 png,jpeg?当我执行上面的代码时,我根本没有得到任何图像预览。