কম্পিউটার

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


imagecolorallocate() ফাংশন একটি ছবির জন্য একটি রঙ বরাদ্দ করে।

সিনট্যাক্স

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

প্যারামিটার

  • img: imagecreatetruecolor().

    দিয়ে ইমেজ রিসোর্স তৈরি করা হয়েছে
  • লাল: লাল রঙের উপাদান

  • সবুজ: সবুজ রঙের উপাদান

  • নীল :নীল রঙের উপাদান

ফেরত

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() ফাংশন