I would take a CSS graphic approach to this:
In my example: http://www.catpin.com/poker/
View the HTML source of my example and see how the height
is altered in each <div> ... overflow is hidden.
This is the PHP script:
<head><title>poker chip display</title>
background: url(chips.gif) no-repeat;
$onechip=42; // the height of one chip
$pile1 = array(4,10,2,5,3);
foreach ($pile1 as $count)
$chips = $onechip*$count;
echo"<div class='col' style='height:".$chips."px;'></div> \n";
I have one graphic image with all 10 chips.
I then only display a certain amount of the image by
cutting-off the image with "height" of the <div>.
This would render very fast and is easy to implement.
You of course create any graphic images of chips that you want.
They could be chips from a side-view, or top-view (like I did).
You could also do it horizontally by creating a horizontal graphic
and adjusting the width instead of height.