Using the 24-bit color Alpha Channel
In an RGB palette, the alpha channel is used to specify the "transparency" of a given color in the palette when it is rendered. Note: Alpha channels only apply to 24-bit canvases

imagecolorallocatealpha($img_r, $red, $green, $blue, $alpha);

Where $alpha is a value anywhere from 0 (see-through) to 127 (Solid)

Alpha chaneling handling
<?php

    define
("WIDTH"450);
    
define("HEIGHT"450);

    
$img imagecreatetruecolor(WIDTHHEIGHT);

    
$white imagecolorallocate($img0xFF0xFF0xFF);
    
$yellow imagecolorallocate($img0xFF0xFF00);
    
$red imagecolorallocate($img0xFF00);
    
$blue_t   imagecolorallocatealpha($img000xFF0x40);

    
imagefill($img11$white);

    
imageline($img0,0WIDTH-1HEIGHT-1$blue_t);

    
imagefilledrectangle($img, (WIDTH/2)-50, (HEIGHT/2)-50,
                               (
WIDTH/2)+50, (HEIGHT/2)+50$yellow);
    
imagefilledrectangle($img, (WIDTH/2)-30, (HEIGHT/2)-30,
                               (
WIDTH/2)+30, (HEIGHT/2)+30$red);
    
imagefilledrectangle($img1010WIDTH-11HEIGHT-11$blue_t);
     
    
header("Content-Type: image/png");
    
imagepng($img);
?>