Task: draw color-coded transluscent polygons over lots that are sold or under contract. The origional lot must be visible thru it.
Problem: I can make it draw the polygons fine using imagecolorallocate, but when I use imagecolorallocatealpha (to make it see-through) with an alpha value greater than 0, it just turns it white, and not see-through at all.
Code:
Code: Select all
<?PHP
$getsold=mysql_query("SELECT `points` FROM `lots` WHERE `listinggroup_id` = '".$listinggroup_id."' AND `price` = '<font color=red><b>***SOLD***</b></font>'", $db) or
die (mysql_error());
$getuc=mysql_query("SELECT `points` FROM `lots` WHERE `listinggroup_id` = '".$listinggroup_id."' AND `price` = '<font color=red><b>***UNDER CONTRACT***</b></font>'", $db) or
die (mysql_error());
$img = imagecreatefromgif($tempmap);
$black = imagecolorallocate($img, 0, 0, 0);
$red = imagecolorallocatealpha($img, 255, 0, 0, 95);
$green = imagecolorallocatealpha($img, 0, 255, 0, 95);
while($sold=mysql_fetch_array($getsold)){
$coords = explode("||", $sold['points']);
$nopoints=0;
$xy = "";
foreach($coords as $c){
$presplit = explode(",", $c);
$xy[] = $presplit[0];
$xy[] = $presplit[1];
$nopoints++;
};
imagefilledpolygon($img, $xy, $nopoints, $red);
};
while($uc=mysql_fetch_array($getuc)){
$coords = explode("||", $uc['points']);
$nopoints=0;
$xy = "";
foreach($coords as $c){
$presplit = explode(",", $c);
$xy[] = $presplit[0];
$xy[] = $presplit[1];
$nopoints++;
};
imagefilledpolygon($img, $xy, $nopoints,$green);
};
?>GD Version bundled (2.0.15 compatible) (whatever that means *chuckle*)
GIF read support is enabled.
The origional image is a GIF, and it's being pumped out as a PNG.