কম্পিউটার টিউটোরিয়াল

PHP-তে imagechar() ফাংশন

imagechar() ফাংশন একটি ক্যারেক্টার হরিজেন্টালি ড্র করে।

সিনট্যাক্স

bool imagechar(img, font, x, y, ch, color)

প্যারামিটার

  • img: imagecreatetruecolor() দিয়ে ইমেজ তৈরি করুন।

  • font: ফন্ট সাইজ সেট করুন

  • x: x-কোঅর্ডিনেট

  • y: y-কোঅর্ডিনেট

  • c: ড্র করা ক্যারেক্টার।

  • color: imagecolorallocate() দিয়ে তৈরি করা কালার আইডেন্টিফায়ার।

রিটার্ন

imagechar() ফাংশন সাফল্যে TRUE রিটার্ন করে অথবা ব্যর্থ হলে FALSE।

উদাহরণ

নিচে একটি উদাহরণ:

<?php 
$img = imagecreate(400, 300); 
$str = 'Demo'; 
$bgcolor = imagecolorallocate($img, 30, 80, 70); 
$textcolor = imagecolorallocate($img, 255, 255, 255); 
imagechar($img, 80, 100, 90, $str, $textcolor); 
header('Content-type: image/png'); 
imagepng($img); 
?>

আউটপুট

নিচে আউটপুট:

PHP-তে imagechar() ফাংশন

উদাহরণ

আরেকটি উদাহরণ যেখানে উপরের উদাহরণের মতো ভিন্ন কোঅর্ডিনেট এবং হাইট/প্রস্থ দিয়ে ক্যারেক্টার ড্র করা হয়েছে:

<?php 
$img = imagecreate(350, 270); 
$str = 'Example'; 
$bgcolor = imagecolorallocate($img, 70, 100, 130); 
$textcolor = imagecolorallocate($img, 200, 195, 210); 
imagechar($img, 100, 50, 70, $str, $textcolor); 
header('Content-type: image/png'); 
imagepng($img); 
?>

আউটপুট

নিচে আউটপুট:

PHP-তে imagechar() ফাংশন

  1. PHP-তে imagecreate() ফাংশন

  2. PHP-তে imagefill() ফাংশন

  3. PHP-তে imagefilledrectangle() ফাংশন

  4. PHP-তে imagefilledellipse() ফাংশন