【发布时间】:2018-12-21 02:34:58
【问题描述】:
我已经看到了各种各样的答案,但无论出于何种原因,我似乎都无法让它们发挥作用。
首先,我从我的数据库中提取文件:
try {
$getQuery = "SELECT * FROM firstForm WHERE id =:id";
$statement = $db->prepare($getQuery);
$statement->execute(array(':id' => 2));
if($row = $statement->fetch()) {
$fileName = $row['pic'];
}
}
当我回显 $fileName 时,它会生成“data:image/png;base64...”
如何转换 $fileName 以便在 fpdf 中使用它,如下所示:
$pdf = new FPDF('P','in','A4'); // orientation (portrait), inches, ??
$pdf->SetMargins(0.5,0.5,0.5); // l, t, rs
$pdf->AddPage();
$pdf->Cell(4,3,'', 1, 2, 'C'); // w, h, text, border width, ???, align
$pdf->Image($fileName);
$pdf->Output();
【问题讨论】: