jandelaet Posted June 1, 2008 Share Posted June 1, 2008 Hi, I got a tiny problem with my quality of my colours when I merge to images with GD library. http://www.mz-data.com/imagestest.php?id=basis&team_id=1&maxing=1&partial=1&bg=1 http://www.mz-data.com/imagestest.php?id=basis&team_id=1&maxing=1&partial=1&bg=2 You see when i merge the ball-images the colour of the red balls will disappear in the second image. It's just the same code only the header changes into source "images/bg_header_2.png". I suppose it's something about the setting of the png-file? If anyone can help me I'm searching fot hours for a sollution. Many Thanks, Jan Link to comment https://forums.phpfreaks.com/topic/108230-solved-problems-gd-library/ Share on other sites More sharing options...
helraizer Posted June 1, 2008 Share Posted June 1, 2008 It's very well it being "the same code" but can we see said code? Might make it easier to help you. Post the code you used and we will help. Sam Link to comment https://forums.phpfreaks.com/topic/108230-solved-problems-gd-library/#findComment-554774 Share on other sites More sharing options...
jandelaet Posted June 1, 2008 Author Share Posted June 1, 2008 header('Content-type: image/png'); $im = imageCreate(250,330*$nr); $background = imageColorAllocate ($im, 0, 0, 0); $background = imageColorTransparent($im,$background); $bg_header_src='images/bg_wfo_header_'.$_GET['bg'].'.png'; $bg_header = imageCreateFromPNG($bg_header_src); $bg_mid_src='images/bg_wfo_mid.png'; $bg_mid = imageCreateFromPNG($bg_mid_src) ; $bg_footer_src='images/bg_wfo_footer.png'; $bg_footer = imageCreateFromPNG($bg_footer_src) ; $zwart = ImageColorAllocate($im, 51, 51, 51); $lichtgrijs= ImageColorAllocate($im, 222, 222, 222); $lichtgrijs2= ImageColorAllocate($im, 235, 235, 235); $geel = ImageColorAllocate($im, 242, 244, 41); $wit = ImageColorAllocate($im, 255, 255, 255); $font = 'fonts/arial.TTF'; $font_bold = 'fonts/arialb.TTF'; for($i=0;$i<$nr;$i++) { ImageCopyMerge($im, $bg_header, 0, $i*330+0, 0, 0, 250, 45, 100); ImageCopyMerge($im, $bg_mid, 0, $i*330+45, 0, 0, 250, 237, 100); ImageCopyMerge($im, $bg_footer, 0, $i*330+282, 0, 0, 250, 38, 100); $land_src='images/s_'.mysql_result($sql_spelers,$i,"nationaliteit").'.png'; $land = imageCreateFromPNG($land_src) ; $sp_png = 'images/level_'.mysql_result($sql_spelers,$i,"speed"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"speed_max")=='1'){$sp_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"speed_par")=='1'){$sp_png .='_par';} $sp_png .= '.png'; $sp = imageCreateFrompng($sp_png); $st_png = 'images/level_'.mysql_result($sql_spelers,$i,"stamina"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"stamina_max")=='1'){$st_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"stamina_par")=='1'){$st_png .='_par';} $st_png .= '.png'; $st = imageCreateFrompng($st_png); $pi_png = 'images/level_'.mysql_result($sql_spelers,$i,"play_intelligence"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"play_intelligence_max")=='1'){$pi_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"play_intelligence_par")=='1'){$pi_png .='_par';} $pi_png .= '.png'; $pi = imageCreateFromPNG($pi_png); $pa_png = 'images/level_'.mysql_result($sql_spelers,$i,"passing"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"passing_max")=='1'){$pa_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"passing_par")=='1'){$pa_png .='_par';} $pa_png .= '.png'; $pa = imageCreateFrompng($pa_png); $sh_png = 'images/level_'.mysql_result($sql_spelers,$i,"shooting"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"shooting_max")=='1'){$sh_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"shooting_par")=='1'){$sh_png .='_par';} $sh_png .= '.png'; $sh = imageCreateFrompng($sh_png); $he_png = 'images/level_'.mysql_result($sql_spelers,$i,"header"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"header_max")=='1'){$he_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"header_par")=='1'){$he_png .='_par';} $he_png .= '.png'; $he = imageCreateFrompng($he_png); $ke_png = 'images/level_'.mysql_result($sql_spelers,$i,"keeping"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"keeping_max")=='1'){$ke_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"keeping_par")=='1'){$ke_png .='_par';} $ke_png .= '.png'; $ke = imageCreateFrompng($ke_png); $bc_png = 'images/level_'.mysql_result($sql_spelers,$i,"ball_control"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"ball_control_max")=='1'){$bc_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"ball_control_par")=='1'){$bc_png .='_par';} $bc_png .= '.png'; $bc = imageCreateFrompng($bc_png); $ta_png = 'images/level_'.mysql_result($sql_spelers,$i,"tackling"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"tackling_max")=='1'){$ta_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"tackling_par")=='1'){$ta_png .='_par';} $ta_png .= '.png'; $ta = imageCreateFrompng($ta_png); $cb_png = 'images/level_'.mysql_result($sql_spelers,$i,"cross_balls"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"cross_balls_max")=='1'){$cb_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"cross_balls_par")=='1'){$cb_png .='_par';} $cb_png .= '.png'; $cb = imageCreateFrompng($cb_png); $se_png = 'images/level_'.mysql_result($sql_spelers,$i,"set_plays"); if($_GET["maxing"]=='1' && mysql_result($sql_spelers,$i,"set_plays_max")=='1'){$se_png .='_max';} if($_GET["partial"]=='1' && mysql_result($sql_spelers,$i,"set_plays_par")=='1'){$se_png .='_par';} $se_png .= '.png'; $se = imageCreateFrompng($se_png); $ex_png = 'images/level_'.mysql_result($sql_spelers,$i,"experience"); $ex_png .= '.png'; $ex = imageCreateFrompng($ex_png); $last_update = explode("-", mysql_result($sql_spelers,$i,"last_update")); $last_update = "$last_update[2]-$last_update[1]-$last_update[0]"; $info = mysql_result($sql_spelers,$i,"voornaam"); $text = replace_spelers($info); $text .= ' '; $info = mysql_result($sql_spelers,$i,"achternaam"); $text .= replace_spelers($info); $text .= '('; $text .= mysql_result($sql_spelers,$i,"leeftijd"); $text .= ')'; ImageTTFText($im, 10, 0, 50, 15+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"shirtnummer"); if(mysql_result($sql_spelers,$i,"shirtnummer")<10) { ImageTTFText($im, 10, 0, 14, 22+330*$i, $zwart, $font_bold, $text); } else { ImageTTFText($im, 10, 0, 10, 22+330*$i, $zwart, $font_bold, $text); } $text = email("waarde"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 62+330*$i, $zwart, $font_bold, $text); $text = email("salaris2"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 80+330*$i, $zwart, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"waarde").' EUR'; ImageTTFText($im, 8, 0, 80, 62+330*$i, $zwart, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"salaris").' EUR'; ImageTTFText($im, 8, 0, 80, 80+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $land, 230, 2+330*$i, 0, 0, 19, 12, 100); $text = email("speed"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 98+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $sp, 120, 90+330*$i, 0, 0, 118, 10, 100); $text = email("stamina"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 112.5+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $st, 120, 104.5+330*$i, 0, 0, 118, 10, 100); $text = email("play_intelligence"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 127+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $pi, 120, 119+330*$i, 0, 0, 118, 10, 100); $text = email("passing"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 141.5+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $pa, 120, 133.5+330*$i, 0, 0, 118, 10, 100); $text = email("shooting"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 156+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $sh, 120, 148+330*$i, 0, 0, 118, 10, 100); $text = email("header"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 170.5+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $he, 120, 162.5+330*$i, 0, 0, 118, 10, 100); $text = email("keeping"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 185+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $ke, 120, 177+330*$i, 0, 0, 118, 10, 100); $text = email("ball_control"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 199.5+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $bc, 120, 191.5+330*$i, 0, 0, 118, 10, 100); $text = email("tackling"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 214+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $ta, 120, 206+330*$i, 0, 0, 118, 10, 100); $text = email("cross_balls"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 228.5+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $cb, 120, 220.5+330*$i, 0, 0, 118, 10, 100); $text = email("set_plays"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 243+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $se, 120, 235+330*$i, 0, 0, 118, 10, 100); $text = email("experience"); $text = replace_spelers($text); $text .=':'; ImageTTFText($im, 8, 0, 10, 257.5+330*$i, $zwart, $font_bold, $text); ImageCopyMerge($im, $ex, 120, 249.5+330*$i, 0, 0, 118, 10, 100); $text = "Ke"; ImageTTFText($im, 8, 0, 10, 300+330*$i, $geel, $font_bold, $text); $text = "Def"; ImageTTFText($im, 8, 0, 50, 300+330*$i, $geel, $font_bold, $text); $text = "Mid"; ImageTTFText($im, 8, 0, 90, 300+330*$i, $geel, $font_bold, $text); $text = "M-W"; ImageTTFText($im, 8, 0, 130, 300+330*$i, $geel, $font_bold, $text); $text = "D-W"; ImageTTFText($im, 8, 0, 170, 300+330*$i, $geel, $font_bold, $text); $text = "Att"; ImageTTFText($im, 8, 0, 210, 300+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"sc_keeper"); ImageTTFText($im, 8, 0, 10, 315+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"sc_verdediger"); ImageTTFText($im, 8, 0, 50, 315+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"sc_middenvelder"); ImageTTFText($im, 8, 0, 90, 315+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"sc_winger"); ImageTTFText($im, 8, 0, 130, 315+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"sc_winger2"); ImageTTFText($im, 8, 0, 170, 315+330*$i, $geel, $font_bold, $text); $text = mysql_result($sql_spelers,$i,"sc_aanvaller"); ImageTTFText($im, 8, 0, 210, 315+330*$i, $geel, $font_bold, $text); } imagepng($im); imageDestroy($im); } Link to comment https://forums.phpfreaks.com/topic/108230-solved-problems-gd-library/#findComment-554776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.