diff --git a/admin/.php b/admin/.php
new file mode 100644
index 0000000..5df5df3
--- /dev/null
+++ b/admin/.php
@@ -0,0 +1,94 @@
+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/generate_card.php b/admin/generate_card.php
index e8553ea..5df5df3 100644
--- a/admin/generate_card.php
+++ b/admin/generate_card.php
@@ -1,5 +1,6 @@
utf8Glyphs($text);
}
// --- Image Generation ---
-header('Content-Type: image/jpeg');
+header('Content-Type: image/png');
$image = imagecreatefrompng($template_image);
+imagealphablending($image, true);
+imagesavealpha($image, true);
// Colors
$text_color = imagecolorallocate($image, 0, 0, 0); // Black
@@ -82,5 +90,5 @@ foreach ($lines as $i => $line) {
// --- Output ---
-imagejpeg($image);
+imagepng($image);
imagedestroy($image);
diff --git a/admin/settings.php b/admin/settings.php
index 2ed8880..210fad5 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -48,7 +48,7 @@ $is_rtl = (get_current_lang() === 'ar');
-
+
-
+
+