I use tcpdf with php to generate a pdf file. It can display text correctly. However, when I tried to display an image, I got this error message: "TCPDF error: Missing or incorrect image file: [URL]". [URL] is the link of the image I wanted to display. When I tried to open [URL] in a browser, the image could show up normally.
I have tried to fix this by using CURL, but it made the program unresponsive. I have also tried to use @getimagesize without success.
$rep = new FrontReport(_("ASSET REGISTRATION VIEW"), "Asset Registration View", user_pagesize(), 9, $orientation);
$rep->SetHeaderType('HeaderAssetRegView');
$rep->Font();
$rep->Info($params, $cols, null, $aligns);
$rep->NewPage();
$result = get_asset_registration_details($asset_type_name, $year, $month, $emp_id);
$rep->row = 710;
while ($myrow2=db_fetch($result)) {
$asset_type_name_detail = $myrow2['asset_type_name'];
$asset_id_detail = $myrow2['asset_id'];
$reg_date_detail = $myrow2['trx_date'];
$emp_id_detail = $myrow2['emp_id'];
$emp_name_detail = $myrow2['employee_name'];
$project_code_detail = $myrow2['project_code'];
$img_root = 'https://myserver.com/ci-rest/uploads/';
$img_detail = $myrow2["file_path"];
$img_link = $img_root . $img_detail;
$no++;
$rep->TextCol(0, 1, $no, -2);
$rep->TextCol(1, 1, 'Asset Type Name', -2);
$rep->TextColLines(2, 1, ': ' . $asset_type_name_detail, -2);
$rep->TextCol(1, 2, 'Asset ID', -2);
$rep->TextColLines(2, 2, ': ' . $asset_id_detail, -2);
$rep->TextCol(1, 3, 'Reg Date', -2);
$rep->TextColLines(2, 3, ': ' . $reg_date_detail, -2);
$rep->TextCol(1, 4, 'Employee ID', -2);
$rep->TextColLines(2, 4, ': ' . $emp_id_detail, -2);
$rep->TextCol(1, 5, 'Employee Name', -2);
$rep->TextColLines(2, 5, ': ' . $emp_name_detail, -2);
$rep->TextCol(1, 6, 'Project Code', -2);
$rep->TextColLines(2, 6, ': ' . $project_code_detail, -2);
$rep->AddImage($img_link, 300, $rep->row, 80, 80);
$rep->NewLine();
}
$rep->End();
I expect the output will show images, not an error message.
Any help would be very appreciated.