Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

gd - PHP imagettftext always drawing black -


basically when draw text it's ending black this: http://i.stack.imgur.com/z675f.png instead of color i'm allocated in php , function. code:

    $finalimage = imagecreatefrompng($imagefile);     $logo = imagecreatefrompng($logoimage);     imagecopy($finalimage, $logo, $logoposition['x'], $logoposition['y'], 0, 0, imagesx($logo), imagesy($logo));     $font = "arial.ttf";     $fontsize = 10;     $yoffset = 15;     $white = imagecolorallocate($finalimage, 255, 255, 255);     foreach($pixelarray $key => $x) {         foreach($valuearray[$key] $valuetext) {              imagettftext($finalimage, $fontsize, 0, $x, $yoffset, $white, $font, $valuetext);             $yoffset += 15;         }         $yoffset = 15;     }     if($misctext != null) {         foreach($misctext $key => $text) {             imagettftext($finalimage, $fontsize, 0, $text['x'], $text['y'], $white, $font, $text['text']);             }     }     imagepng($finalimage,$savefilename.".png");     imagedestroy($finalimage); 

it working before, stopped , have no clue why. after changed source image (was generating fine) , hadn't touched code. i've tried sorts of things changing colors, can't display in other black.

have checked if imagecolorallocate() function returning boolean false, if allocation fails? if $finalimage .png 8bit, , pure white color isn't in source image's palette, call fail. changed source image, why it's broken now.

$white = imagecolorallocate($finalimage, 255, 255, 255); if ($white === false) { // note === -> strict type comparison     die("failed allocate color 255/255/255") } 

the function return number representing color triplets, in case 0xffffff. can try passing imagegetttftext() call directly, see if helps.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -