feat: input field saiz font No IC dalam konfigurasi template
- Tambah fields[name][ic_font_size] dalam form — baris: Warna | Saiz Font No IC | Align - Default: 70% daripada saiz font nama (sebelum ini hardcode 50%) - loadPreview() hantar ic_font_size terkini ke endpoint pratonton - writeIcBelow() baca ic_font_size dari config, fallback 70% jika tiada - Validasi updateConfig: ic_font_size nullable|integer|min:8|max:200 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -90,13 +90,14 @@ class CertificateService
|
||||
return $image->encode(new JpegEncoder(85))->toString();
|
||||
}
|
||||
|
||||
// Tulis IC di bawah nama — auto-posisi, font 50% nama
|
||||
// Tulis IC di bawah nama — auto-posisi Y, saiz font dari config atau fallback 70%
|
||||
private function writeIcBelow(\Intervention\Image\Interfaces\ImageInterface $image, string $ic, array $nameCfg): void
|
||||
{
|
||||
$nameFontSize = (int) ($nameCfg['font_size'] ?? 48);
|
||||
$icFontSize = (int) round($nameFontSize * 0.5);
|
||||
$icFontSize = isset($nameCfg['ic_font_size']) && (int) $nameCfg['ic_font_size'] > 0
|
||||
? (int) $nameCfg['ic_font_size']
|
||||
: (int) round($nameFontSize * 0.7);
|
||||
|
||||
// Y offset: line height nama (1.4×) + sedikit jarak
|
||||
$icY = (int) ($nameCfg['y'] ?? 0) + (int) round($nameFontSize * 1.5);
|
||||
|
||||
$this->writeText($image, $ic, array_merge($nameCfg, [
|
||||
|
||||
Reference in New Issue
Block a user