« Playing on the edge | Home | The Immortal Game, by David Shenk »
Add diagrams to your chess blog the easy way
By Steve | October 22, 2006
I’ve always found the routine for adding a chess diagram to a blog posting to be pretty tedious. I generate the diagram using some chess software, save the diagram as an image, upload the image to some directory on my site, and then link to it.
I wanted a way to include a diagram that did not require generating an image file. I’ve been tinkering with on-the-fly image generation using PHP scripts, and last night I finally got it all to work. I created a PHP script that takes a FEN position string as part of the URL and then creates the image automatically. I invite you to link to the script in order to add chess diagrams to your own blog or other web page.
[UPDATE (3-Dec-2006): The script is now called ChessImager. Detailed information about the ChessImager script can be found here.]
11 Responses to “Add diagrams to your chess blog the easy way”
Comments
I'm a club player on the border between Class C and B. I play regularly at the
November 13th, 2006 at 6:46 pm
Wow, that’s a great script. It works well and I’ve been looking for one for a new (small) chess website I hope to start. Would it be possible for me to get the source code for that script? Thanks, and great blog!
November 27th, 2006 at 9:07 am
Andrew, thanks for asking. I’ve decided not to release the source code for now. I intend to keep the URL for the script stable, and I won’t make any incompatible changes to it.
December 12th, 2006 at 3:28 pm
The new enhancements are great steve, I will be continuing to use this I think!
February 19th, 2007 at 10:40 am
It is also possible to use a FEN to diagram conversion as the one on http://chessteacher.110mb.com/
This returns the same kind of chess diagram, but with a circle on the upper right side of the board to indicate who has to move.
February 19th, 2007 at 10:31 pm
Chess Teacher - the point of my script is to avoid the explicit step of converting to a diagram image. I think it’s a pain to have to create an image file and then upload it to the web somewhere in order to display it in a web posting.
March 4th, 2007 at 4:22 am
Yes, but you don’t have to convert it to a diagram image and upload this to the web page.
All you have to do is for example enter something like
rnbqkb1r/pp2pp1p/3p1np1/8/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 0 6 in the post itself to get the diagram on the website. In this case a diagram of the Sicilian Dragon.
March 4th, 2007 at 4:24 am
In my previous post the surrounding fen-tags have disappeared after submitting
October 20th, 2007 at 2:01 am
Steve tomorrow October 22, 2007. So it’s been 1 year now, so it’s time to release the source code.
October 20th, 2007 at 10:08 pm
Ahmed—Why? What does this anniversary have to do with anything?
October 22nd, 2007 at 3:46 am
Well M.Steve I will be honest :I’m trying to develop a personal chess blog for myself, I reached a point where I need a diagram generator. I also intend to add client side javascript for people to interact with the pieces. So it is not sufficient that I make direct links to your chessimager within my chess blog, although it is an easy task, and your website is very responsive, so it will always return that chess position.I tried many times to write that code which generate a html table with dynamic nodes having pointing to the piece in question but I always fail. Also I have to write a code that must parse that FEN string before it can try to generate the table.
October 22nd, 2007 at 8:43 am
Ahmed—Thanks for elaborating. Your first comment seemed like a demand.
I have too many things going on right now to arrange to make the source code available, although I still might consider doing so in the future.
I have thought many times about making an interactive board using JavaScript like you describe. I do not think that the ChessImager PHP source will be that helpful to you. Making an interactive board will require a substantially different architecture and board-drawing method.
You might consider looking at Palview. It’s what I use to generate the interactive boards in my blog. Here’s an example: http://www.eddins.net/steve/chess/2007/09/12/112.