Balandar Posted August 23, 2007 Share Posted August 23, 2007 I am trying to create an opaque filled polygon over an existing image that has text. The image is a map of Indiana with counties on it along with each county name. I want to "highlight" the county when it comes up in a search. Right now I have it so the county has a border drawn around it. I'd rather have an opaque filled polygon instead. But i can't get it to work right. The Code: This is just an extract of the code, but I think you get the general idea. Currently it's not opaque but just a different shade of red, like a pink almost.. and it covers the text, nothing shows through the color. $image = @imagecreatefromgif("indiana_map_files/stout18.gif"); imagealphablending ( $image, true ); // choose a color for the polygon $col_poly = imagecolorallocate($image, 255, 0, 0); imagesetthickness($image, 3); $red = imagecolorresolvealpha($image, 255, 0, 0, 100); foreach($all_ids as $co_id){ // draw the polygon $map_cords = $map_cords_array[$co_id]; $points = count($map_cords)/2; if(!empty($map_cords)){ imagefilledpolygon($image, $map_cords, $points, $red ); } } imagepng($image, "search_results/$new_image_name.png"); // to file Quote Link to comment https://forums.phpfreaks.com/topic/66353-creating-an-opaque-filled-polygon-over-existing-image/ Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 "Currently it not be opaque but just a different shade of red, like a pink almost.. and it covers the text, nothing shows through the color." That's what opaque means... http://www.google.com/search?q=define%3A+opaque The text won't show through an opaque shape. Quote Link to comment https://forums.phpfreaks.com/topic/66353-creating-an-opaque-filled-polygon-over-existing-image/#findComment-331952 Share on other sites More sharing options...
Balandar Posted August 23, 2007 Author Share Posted August 23, 2007 Doh! My terminology is all screwed up. Is it possible to make it translucent (I think that's the right word)? Quote Link to comment https://forums.phpfreaks.com/topic/66353-creating-an-opaque-filled-polygon-over-existing-image/#findComment-331956 Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 Hm, try looking into : http://us.php.net/manual/en/function.imagealphablending.php The comments contain some helpful info as well. Quote Link to comment https://forums.phpfreaks.com/topic/66353-creating-an-opaque-filled-polygon-over-existing-image/#findComment-332002 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.