diff --git a/admin/.php b/admin/.php deleted file mode 100644 index 5df5df3..0000000 --- a/admin/.php +++ /dev/null @@ -1,94 +0,0 @@ -utf8Glyphs($text); -} - -// --- Image Generation --- -header('Content-Type: image/png'); -$image = imagecreatefrompng($template_image); -imagealphablending($image, true); -imagesavealpha($image, true); - -// Colors -$text_color = imagecolorallocate($image, 0, 0, 0); // Black - -// --- Text Wrapping and Positioning --- -$lines = []; -if ($lang === 'ar') { - // Simple reverse for RTL line wrapping (basic) - $words = explode(' ', $text); - $line = ''; - foreach ($words as $word) { - $new_line = $line . ' ' . $word; - $bbox = imagettfbbox($font_size, 0, $font_file, $new_line); - $line_width = abs($bbox[2] - $bbox[0]); - if ($line_width > ($width - 80)) { // 40px margin - $lines[] = $line; - $line = $word; - } else { - $line = $new_line; - } - } - $lines[] = $line; -} else { - $words = explode(' ', $text); - $line = ''; - foreach ($words as $word) { - $new_line = $line . ($line ? ' ' : '') . $word; - $bbox = imagettfbbox($font_size, 0, $font_file, $new_line); - $line_width = abs($bbox[2] - $bbox[0]); - if ($line_width > ($width - 80)) { // 40px margin - $lines[] = $line; - $line = $word; - } else { - $line = $new_line; - } - } - $lines[] = $line; -} - - -// Calculate total text height -$total_text_height = count($lines) * ($font_size * 1.5); -$y_start = ($height - $total_text_height) / 2; - -// Draw text line by line -foreach ($lines as $i => $line) { - $line = trim($line); - $bbox = imagettfbbox($font_size, 0, $font_file, $line); - $line_width = abs($bbox[2] - $bbox[0]); - $x = ($width - $line_width) / 2; - $y = $y_start + ($i * $font_size * 1.5); - imagettftext($image, $font_size, 0, $x, $y, $text_color, $font_file, $line); -} - - -// --- Output --- -imagepng($image); -imagedestroy($image); diff --git a/admin/settings.php b/admin/settings.php index 210fad5..7b0df0d 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -199,15 +199,15 @@ $is_rtl = (get_current_lang() === 'ar');