Deploy: 2026-05-23 18:37:08

This commit is contained in:
Hamza-Ayed
2026-05-23 18:37:08 +03:00
parent 3b42dc64a9
commit 03ece01f98
2 changed files with 57 additions and 18 deletions

View File

@@ -108,6 +108,11 @@ class WhatsAppClient {
if (!is_dir($fontDir)) {
@mkdir($fontDir, 0755, true);
}
$fontDir = realpath($fontDir);
if (!$fontDir) {
return;
}
$fonts = [
'Roboto-Bold.ttf' => 'https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Bold.ttf',
@@ -166,15 +171,17 @@ class WhatsAppClient {
$useTtf = false;
$availableFonts = [];
if (function_exists('imagettftext')) {
$fontDir = __DIR__ . '/../fonts';
if (file_exists($fontDir . '/Roboto-Bold.ttf') && @filesize($fontDir . '/Roboto-Bold.ttf') > 20000) {
$availableFonts[] = $fontDir . '/Roboto-Bold.ttf';
}
if (file_exists($fontDir . '/Lora-Bold.ttf') && @filesize($fontDir . '/Lora-Bold.ttf') > 20000) {
$availableFonts[] = $fontDir . '/Lora-Bold.ttf';
}
if (!empty($availableFonts)) {
$useTtf = true;
$fontDir = realpath(__DIR__ . '/../fonts');
if ($fontDir) {
if (file_exists($fontDir . '/Roboto-Bold.ttf') && @filesize($fontDir . '/Roboto-Bold.ttf') > 20000) {
$availableFonts[] = $fontDir . '/Roboto-Bold.ttf';
}
if (file_exists($fontDir . '/Lora-Bold.ttf') && @filesize($fontDir . '/Lora-Bold.ttf') > 20000) {
$availableFonts[] = $fontDir . '/Lora-Bold.ttf';
}
if (!empty($availableFonts)) {
$useTtf = true;
}
}
}