Advertisement
alneoru

Создание прозрачного изображения

May 5th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. // Создадим изображение размером 55x30
  3. $im = imagecreatetruecolor(55, 30);
  4. $red = imagecolorallocate($im, 255, 0, 0);
  5. $black = imagecolorallocate($im, 0, 0, 0);
  6.  
  7. // Сделаем фон прозрачным
  8. imagecolortransparent($im, $black);
  9.  
  10. // Нарисуем красный прямоугольник
  11. imagefilledrectangle($im, 4, 4, 50, 25, $red);
  12.  
  13. // Сохраним изображение
  14. imagepng($im, './imagecolortransparent.png');
  15. imagedestroy($im);
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement