title: Drawing a tournament bracket (PHP & GD)
body: <p>I'm currently working on drawing a tournament bracket for one of my projects.  It seems to be working drawing smaller brackets but once I get to 16 it starts acting up.</p>
  
  <p>Follow through the links, and see how it falls out of place after 8.</p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/2" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/2</a></p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/4" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/4</a></p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/8" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/8</a></p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/16" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/16</a></p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/32" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/32</a></p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/64" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/64</a></p>
  
  <p><a href="http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/128" rel="nofollow noreferrer">http://www.mattdsworld.com/mmaplayer/index.php/tournament/viewBracket/128</a></p>
  
  <p>After that I get out of ram errors, which isn't really an issue since its legitimate use of ram, and I can justify raising the maximums for this script (of course, it won't run every page load in the final script,the image will be cached).</p>
  
  <p>Anyways, As you can see if you progress through the images, they seem to get more and more off track.</p>
  
  <p>The code is here:
  <a href="http://pastebin.com/f5485b027" rel="nofollow noreferrer">http://pastebin.com/f5485b027</a>
  (should I be posting code like this, or inline?  I wasn't sure)</p>
  
  <p>I am completely lost as to how to fix this, so please input ideas/suggestions.  I don't need a code solution, I just need guidance on the math/positioning.</p>
  
  <p>Thanks,
  Matt</p>