在这里,我想添加一个doc文件头图像。我正在使用Cakephp 2.帮我在doc文件的标题中添加图像。 当我尝试添加它时显示出一些问题。我尝试从我的cakephp目录中使用,我也尝试使用图像链接。
public function admin_get_member_detail() {
if ($this->request->is('post')) {
$data = $this->request->data;
$this->loadModel('Organization');
$this->loadModel('VoteResult');
$this->loadModel('VoteReResult');
$orgData = $this->Organization->find('first', array('conditions' => array('Organization.member_id' => $data['Designation']['member_id'])));
//$image = $this->Html->image('ica-logo.png', array('style' => 'height:100px;width:500px;border: thin solid black; border-radius:5px;'));
$VoteResult = $this->VoteResult->query('select vote.election_id,vote.candidate_id,vote.election_phase,candidate.name,candidate.id,candidate.designation,designation.id,designation.name,sum(vote.vote_val) as total from tbl_vote_result as vote join tbl_candidate as candidate on candidate.id = vote.candidate_id join tbl_designation as designation on designation.id = candidate.designation
where organization_id =' . $orgData['Organization']['id'] . ' group by vote.candidate_id ORDER BY total DESC ');
$ReVoteResult = $this->VoteReResult->query('select vote.election_id,vote.candidate_id,vote.organization_id,vote.election_phase,vote.candidate_deg,candidate.name,candidate.id,candidate.Organization,designation.id,designation.name,sum(vote.vote_val) as total1 from tbl_re_vote_result as vote join tbl_candidate as candidate on candidate.id = vote.candidate_id join tbl_designation as designation on designation.id = vote.candidate_deg
where vote.organization_id = ' . $orgData['Organization']['id'] . ' group by vote.candidate_id ORDER BY total1 DESC');
//pr($ReVoteResult);die;
if (!empty($VoteResult)) {
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=" . $orgData['Organization']['name'] . '_' . date("H:i:s") . '.doc');
$now_date = date('d-m-Y H:i');
echo "<html>";
echo "<head>";
//echo ".<?= $this->Html->image('ica-logo.png', array('style' => 'height:100px;width:500px;border: thin solid black; border-radius:5px;'));
echo "<img src='https://en.facebookbrand.com/wp-content/uploads/2016/09/facebook-live-brc-preview2.png'/>\n";
echo "</head>";
echo "<body>";
echo "<div style='font-size:18px;font-weight:bold;'>" . $orgData['Organization']['name'] . "</div>\n";
echo "<div>Date:$now_date</div>";
echo "<br>";
echo "<br>";
echo "<table align='center' style='text-align:center' border='1' cellpadding='0' cellspacing='0'>";
echo "<tr><td colspan='3'>For Board Member</td></tr>";
echo"<tr><th>Sl No.</th><th>Candidate Name</th><th>Total Vote</th></tr>";
foreach ($VoteResult as $key => $res) {
echo "<tr>";
echo "<td>" . ++$key . "</td>";
echo "<td>" . $res['candidate']['name'] . "</td>";
echo "<td>" . $res[0]['total'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
echo "<table align='center' style='text-align:center' border='1' cellpadding='0' cellspacing='0'>";
echo "<tr><td colspan='3'>For President</td></tr>";
echo"<tr><th>Sl No.</th><th>Candidate Name</th><th>Total Vote</th></tr>";
echo "</table>";
echo "</body>";
echo "</html>";
die;
} else {
$this->Session->setFlash(__('Member Id Invalid'));
$this->redirect($this->referer());
}
}
}