uppercese category qoshildi

This commit is contained in:
2026-04-07 12:15:16 +05:00
parent ea2f24f0a4
commit 48d96f32c1
19 changed files with 17 additions and 10 deletions

View File

@@ -90,14 +90,24 @@ class ConclusionController extends Controller
$pdf = new Fpdi();
$pageCount = $pdf->setSourceFile($tmpPath);
$qrSize = 30; // mm
for ($i = 1; $i <= $pageCount; $i++) {
$tpl = $pdf->importPage($i);
$tpl = $pdf->importPage($i);
$size2 = $pdf->getTemplateSize($tpl);
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
$pdf->useTemplate($tpl);
// Add QR to top-right corner
$pdf->Image($qrPath, $size2['width'] - 45, 15, 30, 30);
if ($i === 1) {
// First page: top-right, inside the frame
$qrX = $size2['width'] - $qrSize - 18;
$qrY = 18;
} else {
// Other pages: bottom-right, pushed to very bottom
$qrX = $size2['width'] - $qrSize - 8;
$qrY = $size2['height'] - $qrSize - 2;
}
$pdf->Image($qrPath, $qrX, $qrY, $qrSize, $qrSize);
}
// Append certificates from the database
@@ -105,23 +115,20 @@ class ConclusionController extends Controller
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);
$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);
$pdf->Image($qrPath, $sizeCert['width'] - $qrSize - 8, $sizeCert['height'] - $qrSize - 2, $qrSize, $qrSize); // bottom-right
}
} 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->Image($qrPath, 210 - $qrSize - 8, 297 - $qrSize - 2, $qrSize, $qrSize); // bottom-right, inside frame
}
}
}