$value) { $txt .= word2uni($value); $txt .= ' '; } $fontFile = "assets/fonts/text-font-cairo/Cairo-Medium.ttf"; $fontSize = 35; $fontColor = imagecolorallocate($img, 219, 48, 146); $posX = 370; // if(count($text_arr) > 1){ // $posX = $posX - 80 ; // } $posY = 470; $angle = 0; imagettftext($img, $fontSize, $angle, $posX, $posY, $fontColor, $fontFile, $txt); // (B) WRITE DATE $txt = "01-01-2023"; $fontFile = "assets/fonts/text-font-cairo/Cairo-Medium.ttf"; $fontSize = 16; $fontColor = imagecolorallocate($img, 0, 0, 0); $posX = 480; $posY = 654; $angle = 0; imagettftext($img, $fontSize, $angle, $posX, $posY, $fontColor, $fontFile, $txt); // (B) WRITE CODE NUMBER $txt = "AC-000000"; $fontFile = "assets/fonts/text-font-cairo/Cairo-Bold.ttf"; $fontSize = 16; $fontColor = imagecolorallocate($img, 0, 0, 0); $posX = 270; $posY = 559; $angle = 0; imagettftext($img, $fontSize, $angle, $posX, $posY, $fontColor, $fontFile, $txt); // (B) WRITE TRETMENT NAME $txt = ''; $str = 'مهند بشير'; $text_arr = explode(" ",$str); krsort($text_arr); foreach ($text_arr as $key => $value) { $txt .= word2uni($value); $txt .= ' '; } $fontFile = "assets/fonts/text-font-cairo/Cairo-Bold.ttf"; $fontSize = 16; $fontColor = imagecolorallocate($img, 0, 0, 0); $posX = 670; if(count($text_arr) > 1){ $posX = $posX - 80 ; } $posY = 559; $angle = 0; imagettftext($img, $fontSize, $angle, $posX, $posY, $fontColor, $fontFile, $txt); // (C) OUTPUT IMAGE // (C1) DIRECTLY SHOW IMAGE header("Content-type: image/jpg"); imagejpeg($img); imagedestroy($img); // (C2) OR SAVE TO A FILE // $quality = 100; // 0 to 100 // imagejpeg($img, "demo.jpg", $quality);