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

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

imagecolorallocate() ফাংশন একটি ইমেজের জন্য কালোর অ্যালোকেট করে।

সিনট্যাক্স

int imagecolorallocate ($img, $red, $green, $blue)

প্যারামিটার

  • img: imagecreatetruecolor() দিয়ে তৈরি ইমেজ রিসোর্স।

  • red: রেড কালার কম্পোনেন্ট

  • green: গ্রিন কালার কম্পোনেন্ট

  • blue: ব্লু কালার কম্পোনেন্ট

রিটার্ন

imagecolorallocate() ফাংশন RGB ফরম্যাটে কালার রিটার্ন করে।

উদাহরণ

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

<?php 
$img = imagecreatetruecolor(600, 220); 
$bgcolor = imagecolorallocate($img, 20, 50, 120); 
imagefill($img, 0, 0, $bgcolor); 
header("Content-type: image/png"); 
imagepng($img); 
imagedestroy($img); 
?>

আউটপুট

নিচে আউটপুট:

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

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

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

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

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