From 254b8b9094d7058ba0ff366dbed3fe5115cbbae2 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sat, 23 May 2026 18:30:59 +0300 Subject: [PATCH] Deploy: 2026-05-23 18:30:59 --- backend/api/debug-fonts.php | 31 +++++++++++++++++++++++++++++++ backend/includes/WhatsApp.php | 10 +++++----- 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 backend/api/debug-fonts.php diff --git a/backend/api/debug-fonts.php b/backend/api/debug-fonts.php new file mode 100644 index 0000000..8db96b7 --- /dev/null +++ b/backend/api/debug-fonts.php @@ -0,0 +1,31 @@ + true, + 'size' => filesize($path), + 'readable' => is_readable($path), + 'md5' => md5_file($path) + ]; + } +} + +$gdInfo = function_exists('gd_info') ? gd_info() : 'Not available'; +$ttfSupport = function_exists('imagettftext'); + +echo json_encode([ + 'font_dir_exists' => is_dir($fontDir), + 'font_dir_path' => realpath($fontDir), + 'files' => $files, + 'gd_info' => $gdInfo, + 'imagettftext_exists' => $ttfSupport +], JSON_PRETTY_PRINT); +?> diff --git a/backend/includes/WhatsApp.php b/backend/includes/WhatsApp.php index 8ede06e..1138487 100644 --- a/backend/includes/WhatsApp.php +++ b/backend/includes/WhatsApp.php @@ -116,10 +116,10 @@ class WhatsAppClient { foreach ($fonts as $filename => $url) { $path = $fontDir . '/' . $filename; - if (!file_exists($path) || @filesize($path) < 1000) { + if (!file_exists($path) || @filesize($path) < 20000) { // Try file_get_contents first $content = @file_get_contents($url); - if ($content !== false && strlen($content) > 1000) { + if ($content !== false && strlen($content) > 20000) { @file_put_contents($path, $content); } elseif (function_exists('curl_init')) { $ch = curl_init($url); @@ -129,7 +129,7 @@ class WhatsAppClient { curl_setopt($ch, CURLOPT_TIMEOUT, 15); $content = curl_exec($ch); curl_close($ch); - if ($content && strlen($content) > 1000) { + if ($content && strlen($content) > 20000) { @file_put_contents($path, $content); } } @@ -167,10 +167,10 @@ class WhatsAppClient { $availableFonts = []; if (function_exists('imagettftext')) { $fontDir = __DIR__ . '/../fonts'; - if (file_exists($fontDir . '/Roboto-Bold.ttf') && @filesize($fontDir . '/Roboto-Bold.ttf') > 1000) { + if (file_exists($fontDir . '/Roboto-Bold.ttf') && @filesize($fontDir . '/Roboto-Bold.ttf') > 20000) { $availableFonts[] = $fontDir . '/Roboto-Bold.ttf'; } - if (file_exists($fontDir . '/CourierPrime-Bold.ttf') && @filesize($fontDir . '/CourierPrime-Bold.ttf') > 1000) { + if (file_exists($fontDir . '/CourierPrime-Bold.ttf') && @filesize($fontDir . '/CourierPrime-Bold.ttf') > 20000) { $availableFonts[] = $fontDir . '/CourierPrime-Bold.ttf'; } if (!empty($availableFonts)) {