uppercese category qoshildi
This commit is contained in:
@@ -90,14 +90,24 @@ class ConclusionController extends Controller
|
|||||||
|
|
||||||
$pdf = new Fpdi();
|
$pdf = new Fpdi();
|
||||||
$pageCount = $pdf->setSourceFile($tmpPath);
|
$pageCount = $pdf->setSourceFile($tmpPath);
|
||||||
|
$qrSize = 30; // mm
|
||||||
|
|
||||||
for ($i = 1; $i <= $pageCount; $i++) {
|
for ($i = 1; $i <= $pageCount; $i++) {
|
||||||
$tpl = $pdf->importPage($i);
|
$tpl = $pdf->importPage($i);
|
||||||
$size2 = $pdf->getTemplateSize($tpl);
|
$size2 = $pdf->getTemplateSize($tpl);
|
||||||
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
|
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
|
||||||
$pdf->useTemplate($tpl);
|
$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
|
// Append certificates from the database
|
||||||
@@ -105,23 +115,20 @@ class ConclusionController extends Controller
|
|||||||
foreach ($certificates as $certificate) {
|
foreach ($certificates as $certificate) {
|
||||||
$certPath = storage_path('app/' . $certificate->path);
|
$certPath = storage_path('app/' . $certificate->path);
|
||||||
if (file_exists($certPath)) {
|
if (file_exists($certPath)) {
|
||||||
// Support both PDF and Image certificates
|
|
||||||
$extCert = strtolower(pathinfo($certPath, PATHINFO_EXTENSION));
|
$extCert = strtolower(pathinfo($certPath, PATHINFO_EXTENSION));
|
||||||
if ($extCert === 'pdf') {
|
if ($extCert === 'pdf') {
|
||||||
$certPageCount = $pdf->setSourceFile($certPath);
|
$certPageCount = $pdf->setSourceFile($certPath);
|
||||||
for ($j = 1; $j <= $certPageCount; $j++) {
|
for ($j = 1; $j <= $certPageCount; $j++) {
|
||||||
$tplCert = $pdf->importPage($j);
|
$tplCert = $pdf->importPage($j);
|
||||||
$sizeCert = $pdf->getTemplateSize($tplCert);
|
$sizeCert = $pdf->getTemplateSize($tplCert);
|
||||||
$pdf->AddPage($sizeCert['orientation'], [$sizeCert['width'], $sizeCert['height']]);
|
$pdf->AddPage($sizeCert['orientation'], [$sizeCert['width'], $sizeCert['height']]);
|
||||||
$pdf->useTemplate($tplCert);
|
$pdf->useTemplate($tplCert);
|
||||||
// Add watermark to certificate page too
|
$pdf->Image($qrPath, $sizeCert['width'] - $qrSize - 8, $sizeCert['height'] - $qrSize - 2, $qrSize, $qrSize); // bottom-right
|
||||||
$pdf->Image($qrPath, $sizeCert['width'] - 45, 15, 30, 30);
|
|
||||||
}
|
}
|
||||||
} elseif (in_array($extCert, ['jpg', 'jpeg', 'png'])) {
|
} elseif (in_array($extCert, ['jpg', 'jpeg', 'png'])) {
|
||||||
$pdf->AddPage('P', 'A4');
|
$pdf->AddPage('P', 'A4');
|
||||||
$pdf->Image($certPath, 0, 0, 210, 297);
|
$pdf->Image($certPath, 0, 0, 210, 297);
|
||||||
// Add watermark
|
$pdf->Image($qrPath, 210 - $qrSize - 8, 297 - $qrSize - 2, $qrSize, $qrSize); // bottom-right, inside frame
|
||||||
$pdf->Image($qrPath, 210 - 45, 15, 30, 30);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
storage/app/public/attachments/auto_7891/qr.png
Normal file
BIN
storage/app/public/attachments/auto_7891/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
BIN
storage/app/public/attachments/auto_7892/qr.png
Normal file
BIN
storage/app/public/attachments/auto_7892/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
BIN
storage/app/public/attachments/auto_7893/qr.png
Normal file
BIN
storage/app/public/attachments/auto_7893/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Binary file not shown.
BIN
storage/app/public/attachments/auto_7894/qr.png
Normal file
BIN
storage/app/public/attachments/auto_7894/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
storage/app/public/attachments/auto_7895/qr.png
Normal file
BIN
storage/app/public/attachments/auto_7895/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
BIN
storage/app/public/attachments/estate_8179/qr.png
Normal file
BIN
storage/app/public/attachments/estate_8179/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Reference in New Issue
Block a user