function genstacks($a){ $a = intval($a); $stackpath = 'stacks/'; function imagettfstroketext(&$image, $size, $angle, $x, $y, &$textcolor, &$strokecolor, $fontfile, $text, $px){ for($c1 = ($x-abs($px)); $c1 <= ($x+abs($px)); $c1++) for($c2 = ($y-abs($px)); $c2 <= ($y+abs($px)); $c2++) $bg = imagettftext($image, $size, $angle, $c1, $c2, $strokecolor, $fontfile, $text); return imagettftext($image, $size, $angle, $x, $y, $textcolor, $fontfile, $text); } $cs = intval(intval($a)/10000); $cr = intval(intval($a)%10000); $ps = intval(intval($cr)/100); $gs = intval(intval($cr)%100); $stackWidth = 2; if($cs > 100){ $cu = $cs; while($cu > 100){ $stackWidth += 34; $cu = $cu-100; } if($cu >= 1){ $stackWidth += 34; } }else if($cs >= 1){ $stackWidth += 34; } if($ps >= 1){ $stackWidth += 34; } if($gs >= 1){ $stackWidth += 34; } $img = imagecreatetruecolor($stackWidth, 32); imagesavealpha($img, true); $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127); imagefill($img, 0, 0, $trans_colour); $stroke_color = imagecolorallocate($img, 0, 0, 0); $text_color = imagecolorallocate($img, 255, 255, 255); $xPosition = 2; if($cs > 100){ $cu = $cs; $ci = ''; while($cu > 100){ $src = imagecreatefrompng($stackpath . 'c-50-100.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 9, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", 100, 1); $xPosition += 34; $cu = $cu-100; } if($cu >= 50){ $src = imagecreatefrompng($stackpath . 'c-50-100.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); if($cu == 100){ imagettfstroketext($img, 8, 0, $xPosition + 9, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); }else{ imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); } $xPosition += 34; }else if($cu >= 25){ $src = imagecreatefrompng($stackpath . 'c-25-49.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; }else if($cu >= 10){ $src = imagecreatefrompng($stackpath . 'c-10-24.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; }else if($cu >= 5){ $src = imagecreatefrompng($stackpath . 'c-5-9.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; }else if($cu == 4){ $src = imagecreatefrompng($stackpath . 'c-4.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; }else if($cu == 3){ $src = imagecreatefrompng($stackpath . 'c-3.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; }else if($cu == 2){ $src = imagecreatefrompng($stackpath . 'c-2.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; }else if($cu == 1){ $src = imagecreatefrompng($stackpath . 'c-1.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cu, 1); $xPosition += 34; } }else if($cs >= 50){ $src = imagecreatefrompng($stackpath . 'c-50-100.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); if($cs == 100){ imagettfstroketext($img, 8, 0, $xPosition + 9, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); }else{ imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); } $xPosition += 34; }else if($cs >= 25){ $src = imagecreatefrompng($stackpath . 'c-25-49.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; }else if($cs >= 10){ $src = imagecreatefrompng($stackpath . 'c-10-24.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; }else if($cs >= 5){ $src = imagecreatefrompng($stackpath . 'c-5-9.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; }else if($cs == 4){ $src = imagecreatefrompng($stackpath . 'c-4.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; }else if($cs == 3){ $src = imagecreatefrompng($stackpath . 'c-3.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; }else if($cs == 2){ $src = imagecreatefrompng($stackpath . 'c-2.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; }else if($cs == 1){ $src = imagecreatefrompng($stackpath . 'c-1.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $cs, 1); $xPosition += 34; } if($ps >= 50){ $src = imagecreatefrompng($stackpath . 'p-50-100.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); if($ps == 100){ imagettfstroketext($img, 8, 0, $xPosition + 9, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); }else{ imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); } $xPosition += 34; }else if($ps >= 25){ $src = imagecreatefrompng($stackpath . 'p-25-49.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; }else if($ps >= 10){ $src = imagecreatefrompng($stackpath . 'p-10-24.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; }else if($ps >= 5){ $src = imagecreatefrompng($stackpath . 'p-5-9.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; }else if($ps == 4){ $src = imagecreatefrompng($stackpath . 'p-4.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; }else if($ps == 3){ $src = imagecreatefrompng($stackpath . 'p-3.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; }else if($ps == 2){ $src = imagecreatefrompng($stackpath . 'p-2.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; }else if($ps == 1){ $src = imagecreatefrompng($stackpath . 'p-1.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1); $xPosition += 34; } if($gs >= 50){ $src = imagecreatefrompng($stackpath . 'g-50-100.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); if($gs == 100){ imagettfstroketext($img, 8, 0, $xPosition + 9, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); }else{ imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); } $xPosition += 34; }else if($gs >= 25){ $src = imagecreatefrompng($stackpath . 'g-25-49.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; }else if($gs >= 10){ $src = imagecreatefrompng($stackpath . 'g-10-24.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 17, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; }else if($gs >= 5){ $src = imagecreatefrompng($stackpath . 'g-5-9.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; }else if($gs == 4){ $src = imagecreatefrompng($stackpath . 'g-4.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; }else if($gs == 3){ $src = imagecreatefrompng($stackpath . 'g-3.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; }else if($gs == 2){ $src = imagecreatefrompng($stackpath . 'g-2.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; }else if($gs == 1){ $src = imagecreatefrompng($stackpath . 'g-1.png'); imagecopy($img, $src, $xPosition, 0, 0, 0, 32, 32); imagettfstroketext($img, 8, 0, $xPosition + 23, 30, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1); $xPosition += 34; } imagepng($img, "coinstacks.png"); imagecolordeallocate($img, $line_color); imagecolordeallocate($img, $text_color); imagecolordeallocate($img, $trans_colour); imagedestroy($img); }