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 \
|
libzip-dev \
|
||||||
zip unzip \
|
zip unzip \
|
||||||
git \
|
git \
|
||||||
|
ghostscript \
|
||||||
libmagickwand-dev --no-install-recommends && \
|
libmagickwand-dev --no-install-recommends && \
|
||||||
docker-php-ext-install bcmath gd zip && \
|
docker-php-ext-install bcmath gd zip && \
|
||||||
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \
|
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]);
|
$qrContent = route('qr.verify', ['type' => $cleanType, 'id' => $orderId]);
|
||||||
$qrImage = QrCode::format('png')->size(150)->generate($qrContent);
|
$qrImage = QrCode::format('png')->size(150)->generate($qrContent);
|
||||||
file_put_contents($qrPath, $qrImage);
|
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();
|
$pdf = new Fpdi();
|
||||||
@@ -98,17 +106,12 @@ class ConclusionController extends Controller
|
|||||||
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
|
$pdf->AddPage($size2['orientation'], [$size2['width'], $size2['height']]);
|
||||||
$pdf->useTemplate($tpl);
|
$pdf->useTemplate($tpl);
|
||||||
|
|
||||||
if ($i === 1) {
|
// All pages: bottom-right corner, white background
|
||||||
// First page: top-right, 30mm
|
|
||||||
$sz = 30;
|
|
||||||
$qrX = $size2['width'] - $sz - 18;
|
|
||||||
$qrY = 18;
|
|
||||||
} else {
|
|
||||||
// Other pages: bottom-right, 22mm, very bottom
|
|
||||||
$sz = 22;
|
$sz = 22;
|
||||||
$qrX = $size2['width'] - $sz - 8;
|
$qrX = $size2['width'] - $sz - 8;
|
||||||
$qrY = $size2['height'] - $sz - 2;
|
$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);
|
$pdf->Image($qrPath, $qrX, $qrY, $sz, $sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,19 +128,27 @@ class ConclusionController extends Controller
|
|||||||
$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);
|
||||||
$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'])) {
|
} 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);
|
||||||
$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);
|
$pdf->Output('F', $outputPath);
|
||||||
} catch (\Exception $e) {
|
} 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);
|
copy($tmpPath, $outputPath);
|
||||||
}
|
}
|
||||||
} else {
|
} 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