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

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

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

সিনট্যাক্স

imagecolorallocatealpha (img, red, green, blue, alpha)

প্যারামিটার

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

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

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

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

  • alpha: ইমেজের ট্রান্সপারেন্সি, ০ বোঝায় সম্পূর্ণ ওপেক, ১২৭ বোঝায় সম্পূর্ণ ট্রান্সপারেন্ট।

রিটার্ন

imagecolorallocatealpha() ফাংশন কালার আইডেন্টিফায়ার রিটার্ন করে অথবা অ্যালোকেশন ফেইল হলে FALSE।

উদাহরণ

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

<?php 
$img = imagecreatetruecolor(520, 350); 
$bgcolor = imagecolorallocate($img, 50, 10, 255); 
imagefill($img, 0, 0, $bgcolor); 
$one = imagecolorallocatealpha($img, 50, 255, 0, 70); 
$two = imagecolorallocatealpha($img, 255, 0, 255, 50); 
$three = imagecolorallocatealpha($img, 150, 255, 0, 60); 
$four = imagecolorallocatealpha($img, 200, 0, 255, 90); 
imagefilledellipse($img, 200, 150, 150, 150, $one); 
imagefilledellipse($img, 220, 150, 150, 150, $two); 
imagefilledellipse($img, 240, 150, 150, 150, $three); 
imagefilledellipse($img, 280, 150, 150, 150, $four); 
header('Content-Type: image/png'); 
imagepng($img); 
imagedestroy($img); 
?>

আউটপুট

নিচে আউটপুট:

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

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

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

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

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