uppercese category qoshildi

This commit is contained in:
2026-04-07 02:23:32 +05:00
parent 48f7f784b9
commit 3b10c41c36
5 changed files with 180 additions and 119 deletions

View File

@@ -96,8 +96,34 @@ class ConclusionController extends Controller
$size2 = $pdf->getTemplateSize($tpl);
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
$pdf->useTemplate($tpl);
// Add QR to bottom-right corner
$pdf->Image($qrPath, $size2['width'] - 35, $size2['height'] - 35, 30, 30);
// Add QR to top-right corner
$pdf->Image($qrPath, $size2['width'] - 45, 15, 30, 30);
}
// Append certificates from the database
$certificates = DB::table('certificates')->orderBy('sort')->get();
foreach ($certificates as $certificate) {
$certPath = storage_path('app/' . $certificate->path);
if (file_exists($certPath)) {
// Support both PDF and Image certificates
$extCert = strtolower(pathinfo($certPath, PATHINFO_EXTENSION));
if ($extCert === 'pdf') {
$certPageCount = $pdf->setSourceFile($certPath);
for ($j = 1; $j <= $certPageCount; $j++) {
$tplCert = $pdf->importPage($j);
$sizeCert = $pdf->getTemplateSize($tplCert);
$pdf->AddPage($sizeCert['orientation'], [$sizeCert['width'], $sizeCert['height']]);
$pdf->useTemplate($tplCert);
// Add watermark to certificate page too
$pdf->Image($qrPath, $sizeCert['width'] - 45, 15, 30, 30);
}
} elseif (in_array($extCert, ['jpg', 'jpeg', 'png'])) {
$pdf->AddPage('P', 'A4');
$pdf->Image($certPath, 0, 0, 210, 297);
// Add watermark
$pdf->Image($qrPath, 210 - 45, 15, 30, 30);
}
}
}
$pdf->Output('F', $outputPath);