addres qoshish da api o'zgartirildi
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
.cache/fontconfig/CACHEDIR.TAG
Normal file
4
.cache/fontconfig/CACHEDIR.TAG
Normal file
@@ -0,0 +1,4 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by fontconfig.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \
|
||||
libzip-dev \
|
||||
zip unzip \
|
||||
git \
|
||||
ghostscript \
|
||||
libmagickwand-dev --no-install-recommends && \
|
||||
docker-php-ext-install bcmath gd zip && \
|
||||
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \
|
||||
|
||||
@@ -86,6 +86,14 @@ class ConclusionController extends Controller
|
||||
$qrContent = route('qr.verify', ['type' => $cleanType, 'id' => $orderId]);
|
||||
$qrImage = QrCode::format('png')->size(150)->generate($qrContent);
|
||||
file_put_contents($qrPath, $qrImage);
|
||||
chmod($qrPath, 0644);
|
||||
}
|
||||
|
||||
// Convert PDF to 1.4 compatible format so FPDI can parse any PDF version
|
||||
$gsTmp = tempnam(sys_get_temp_dir(), 'gs_') . '.pdf';
|
||||
exec('gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sOutputFile=' . escapeshellarg($gsTmp) . ' ' . escapeshellarg($tmpPath) . ' 2>/dev/null', $gsOut, $gsCode);
|
||||
if ($gsCode === 0 && file_exists($gsTmp) && filesize($gsTmp) > 0) {
|
||||
$tmpPath = $gsTmp;
|
||||
}
|
||||
|
||||
$pdf = new Fpdi();
|
||||
@@ -98,17 +106,12 @@ class ConclusionController extends Controller
|
||||
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
|
||||
$pdf->useTemplate($tpl);
|
||||
|
||||
if ($i === 1) {
|
||||
// First page: top-right, 30mm
|
||||
$sz = 30;
|
||||
$qrX = $size2['width'] - $sz - 18;
|
||||
$qrY = 18;
|
||||
} else {
|
||||
// Other pages: bottom-right, 22mm, very bottom
|
||||
// All pages: bottom-right corner, white background
|
||||
$sz = 22;
|
||||
$qrX = $size2['width'] - $sz - 8;
|
||||
$qrY = $size2['height'] - $sz - 2;
|
||||
}
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
$pdf->Rect($qrX - 1, $qrY - 1, $sz + 2, $sz + 2, 'F');
|
||||
$pdf->Image($qrPath, $qrX, $qrY, $sz, $sz);
|
||||
}
|
||||
|
||||
@@ -125,19 +128,27 @@ class ConclusionController extends Controller
|
||||
$sizeCert = $pdf->getTemplateSize($tplCert);
|
||||
$pdf->AddPage($sizeCert['orientation'], [$sizeCert['width'], $sizeCert['height']]);
|
||||
$pdf->useTemplate($tplCert);
|
||||
$pdf->Image($qrPath, $sizeCert['width'] - 22 - 8, $sizeCert['height'] - 22 - 2, 22, 22); // bottom-right
|
||||
$cqX = $sizeCert['width'] - 22 - 8;
|
||||
$cqY = $sizeCert['height'] - 22 - 2;
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
$pdf->Rect($cqX - 1, $cqY - 1, 24, 24, 'F');
|
||||
$pdf->Image($qrPath, $cqX, $cqY, 22, 22);
|
||||
}
|
||||
} elseif (in_array($extCert, ['jpg', 'jpeg', 'png'])) {
|
||||
$pdf->AddPage('P', 'A4');
|
||||
$pdf->Image($certPath, 0, 0, 210, 297);
|
||||
$pdf->Image($qrPath, 210 - 22 - 8, 297 - 22 - 2, 22, 22); // bottom-right, inside frame
|
||||
$pdf->SetFillColor(255, 255, 255);
|
||||
$pdf->Rect(210 - 22 - 8 - 1, 297 - 22 - 2 - 1, 24, 24, 'F');
|
||||
$pdf->Image($qrPath, 210 - 22 - 8, 297 - 22 - 2, 22, 22);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Output('F', $outputPath);
|
||||
} catch (\Exception $e) {
|
||||
// If PDF manipulation fails, just copy the original
|
||||
\Illuminate\Support\Facades\Log::error('ConclusionController PDF/QR failed: ' . $e->getMessage(), [
|
||||
'order_id' => $orderId, 'type' => $orderType, 'file' => $e->getFile(), 'line' => $e->getLine(),
|
||||
]);
|
||||
copy($tmpPath, $outputPath);
|
||||
}
|
||||
} else {
|
||||
|
||||
BIN
storage/app/public/attachments/auto_1/qr.png
Normal file
BIN
storage/app/public/attachments/auto_1/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 427 B |
Binary file not shown.
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_7896/qr.png
Normal file
BIN
storage/app/public/attachments/auto_7896/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
storage/app/public/attachments/auto_9999/qr.png
Normal file
BIN
storage/app/public/attachments/auto_9999/qr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user