Я пытаюсь создать PDF-файл, который также показывает изображение.Таким образом, мое изображение хранится в базе данных, и у меня есть рабочий код, который генерирует данные из моей базы данных в файл PDF.
Это код, который просматривает мое изображение из моей базы данных в таблицу данных
<td ><img onclick="onClick(this)" class="w3-hover-opacity" src="<?php echo base_url('uploads/'.$report["attachment"].'.png'); ?>" style="width:100%;max-width:200px;border-radius: 5px" ></td>
это то, что я сделал, но он печатает только имя файла img
if(isset($_POST["generate_pdf"]))
{
require_once('tcpdf/tcpdf.php');
$obj_pdf = new TCPDF('L', 'mm', 'LETTER', true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetAuthor('Nicola Asuni');
$obj_pdf->SetSubject('TCPDF Tutorial');
$obj_pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$obj_pdf->SetTitle("Incident Report");
$obj_pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(2, '7', PDF_MARGIN_RIGHT, '10');
$obj_pdf->setPrintHeader(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->SetFont('helvetica', '', 5);
$obj_pdf->AddPage();
date_default_timezone_set("Asia/Manila");
$content = '';
$content2 = date("F d, Y h:i:s A",mktime());
$content .= '
<h4 align="center">Incident Report</h4> <br />
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr>
<th width="8%">School</th>
<th width="5%">Grade/Level</th>
<th width="6%">Section</th>
<th width="7%">Date and Time</th>
<th width="6%">Incident Type</th>
<th width="7%">Incident Description</th>
<th width="6%">Sender</th>
<th width="10%">Person Involved</th>
<th width="14%">Students that tagged safe</th>
<th width="14%">Students that tagged unsafe</th>
<th width="4%">Male Count</th>
<th width="5%">Female Count</th>
<th width="5%">Number of involved people</th>
if(isset($_POST["generate_pdf"]))
{
require_once('tcpdf/tcpdf.php');
$obj_pdf = new TCPDF('L', 'mm', 'LETTER', true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetAuthor('Nicola Asuni');
$obj_pdf->SetSubject('TCPDF Tutorial');
$obj_pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$obj_pdf->SetTitle("Incident Report");
$obj_pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(2, '7', PDF_MARGIN_RIGHT, '10');
$obj_pdf->setPrintHeader(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->SetFont('helvetica', '', 5);
$obj_pdf->AddPage();
date_default_timezone_set("Asia/Manila");
$content = '';
$content2 = date("F d, Y h:i:s A",mktime());
$content .= '
<h4 align="center">Incident Report</h4> <br />
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr>
<th width="8%">School</th>
<th width="5%">Grade/Level</th>
<th width="6%">Section</th>
<th width="7%">Date and Time</th>
<th width="6%">Incident Type</th>
<th width="7%">Incident Description</th>
<th width="6%">Sender</th>
<th width="10%">Person Involved</th>
<th width="14%">Students that tagged safe</th>
<th width="14%">Students that tagged unsafe</th>
<th width="4%">Male Count</th>
<th width="5%">Female Count</th>
<th width="5%">Number of involved people</th>
<th width="5%">Attachment</th>
</tr>';
$content .= fetch_data();
$content .= '</table>';
$obj_pdf->writeHTML($content);
$obj_pdf->writeHTML($content2);
$obj_pdf->Output('report.pdf', 'I');
}
?>
</tr>';
$content .= fetch_data();
$content .= '</table>';
$obj_pdf->writeHTML($content);
$obj_pdf->writeHTML($content2);
$obj_pdf->Output('report.pdf', 'I');
}
?>
Нужно ли мне добавить еще $ obj_pdf?и я знаю, что строка <th width="5%">Attachment</th>
печатает только имя файла.Я просто тестирую воды