Any tool to convert FEN strings to diagrams?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Any tool to convert FEN strings to diagrams?

Post by yurikvelo »

www.jinchess.com/chessboard/?p=--r-q--- ... =adventure[/b]

bp and ps parameters in URL allow to change skins


Sorry, missed side to move code:

Code: Select all

<?php 
$fens = file('fen.txt'); 
$url="http://www.jinchess.com/chessboard/?p=%s&tm=%s&download&bp=red-marble&ps=adventure"; 


foreach ($fens as $fen){ 
	$fen=str_replace('/', '', $fen);
	$fen=str_replace('1', '-', $fen); 
	$fen=str_replace('2', '--', $fen); 
	$fen=str_replace('3', '---', $fen); 
	$fen=str_replace('4', '----', $fen); 
	$fen=str_replace('5', '-----', $fen); 
	$fen=str_replace('6', '------', $fen); 
	$fen=str_replace('7', '-------', $fen); 
	$fen=str_replace('8', '--------', $fen); 
	$a = explode(' ', $fen); 

	$result = file_get_contents(sprintf($url, $a[0], $a[1]), false, $context); 

	file_put_contents($a[0].$a[1].'.png', $result); 
}
?>
jinchess allow to encode in URL many more options:
- size, titles, comments, coordinates, arrows

example:

Image