Advertisement
jargon

From: https://www.php.net/manual/en/function.imagecolorallocatealpha.php

Oct 10th, 2021
1,713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. If you need to calculate the integer representation of a color with an alpha channel, without initialising an image and using the imagecolorallocatealpha function. Then this function might be of some help:
  2.  
  3. <?php
  4. function alphaColor($hexColor,$alpha)
  5. {
  6.         return bindec(decbin($alpha).decbin(hexdec($hexColor));
  7. }
  8.  
  9. echo alphaColor("FFFFFF",127);
  10. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement