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

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

imagecolortransparent() ফাংশন একটি ট্রান্সপারেন্ট ইমেজের কালার সেট করতে ব্যবহৃত হয়।

সিনট্যাক্স

imagecolortransparent (img, color)

প্যারামিটার

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

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

রিটার্ন

imagecolortransparent() ফাংশন নতুন ট্রান্সপারেন্ট কালারের আইডেন্টিফায়ার রিটার্ন করে। রিটার্ন ভ্যালু -1 হবে যদি কালার স্পেসিফাই না করা হয় এবং ইমেজে কোনো ট্রান্সপারেন্ট কালার নেই।

উদাহরণ

নিচে একটি উদাহরণ দেওয়া হলো:

<?php 
$img = imagecreatetruecolor(500, 400); 
$blue = imagecolorallocate($img, 0, 0, 255); 
$transparent = imagecolorallocate($img, 0, 0, 0); 
imagecolortransparent($img, $transparent); 
imagefilledrectangle($img, 80, 90, 400, 220, $blue); 
header('Content-Type: image/png'); 
imagepng($img); 
imagedestroy($img); 
?>

আউটপুট

নিচে আউটপুট:

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

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

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

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

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