How to generate semi transparent shapes in php using gdlib

Posted by fabbrillo on Stack Overflow See other posts from Stack Overflow or by fabbrillo
Published on 2010-02-23T14:44:26Z Indexed on 2010/05/20 1:10 UTC
Read the original article Hit count: 339

Filed under:
|
|
|

Hi,

this is the script i made

    // Create image
$img = imagecreatetruecolor($w, $h);

// Transparent image
$white = imagecolorallocate($img,255,255,255);
imagefilledrectangle($img,0,0,$w,$h,$white);
imagecolortransparent($img, $white);

//imagealphablending( $img, true );
//imagesavealpha( $img, true );

// Shape color
$bgColor = imagecolorallocatealpha($img, 100, 250, 250, 70);

imagefilledrectangle($img, 15, 20, 50, 100, $bgColor);
imagefilledrectangle($img, 10, 25, 60, 100, $bgColor);


imagepng($img, 'file.png');

the problem is the rectangles are transparent among them but not with the background

i mean, i need to create a transparent image with a semi transparent shape inside

any suggestions?

thanks for your help

© Stack Overflow or respective owner

Related posts about php

Related posts about gd