php process image files created with complicated url syntax
<p>I have a script on my server that dynamically creates images of chess diagrams:</p>

<pre><code>&lt;img src = "ChessImager/ChessImager.php?fen=r3k2r/1pqb2pp/pnn2p2/4p3/4Q3/NBP1B3/P4PPP/R2R2K1&amp;amp;square_size=45&amp;amp;ds_color=(143,188,143)&amp;amp;ls_color=(232,223,192)"&gt;
</code></pre>

<p>But the resulting image files are nearly 30k, too big. I want to use pngnq <a href="http://pngnq.sourceforge.net/" rel="nofollow">http://pngnq.sourceforge.net/</a> to shrink them. I present them in a slideshow at <a href="http://communitychessclub.com" rel="nofollow">http://communitychessclub.com</a> I want a new php script to create the images from ChessImager.php and pipe each of these diagram image files (~50) to a new filename like 'game1234.png' and I'll batch pre-process (not real-time) them with pngnq. I have a file 'Forsyth.csv' which lists the data:</p>

<p>r1bqk2r/1p2bp1p/p2pnp2/4pN1Q/2B1P3/2N5/PP3PPP/R2R2K1|1256
r3k2r/1pqb2pp/pnn2p2/4p3/4Q3/NBP1B3/P4PPP/R2R2K1|1255
4rrk1/ppp3pp/2n4q/3p4/3P4/1NP1PpPP/PP3Q1K/R4R2|1253
rn2kb1r/1q1p2p1/p3p3/1p2N1Bp/2p1P2P/2P4Q/PP3PP1/3R1RK1|1252</p>

<p>I use this:</p>

<pre><code>&lt;?php $text = file('Forsyth.csv');foreach($text as $line) 
{$token = explode("|", $line); print "\n"; $fen = $token[0]; $game_num = $token[1];
$phrase="games/game$game_num.php"; echo "&lt;li&gt; &lt;img 
src=\"ChessImager/ChessImager.php?fen=$fen&amp;amp;square_size=45&amp;amp;ds_color=(143,188,143)&amp;amp;ls_color=(232,223,192)\" &gt;&lt;/li&gt;";} ?&gt;
</code></pre>

<p>Any ideas? </p>

<p>Update: this is posted at <a href="http://communitychessclub.com/produce.php" rel="nofollow">http://communitychessclub.com/produce.php</a> </p>

<pre><code>&lt;?php $text = file('Forsyth.csv'); foreach($text as $line) {$token = explode("|",
$line); print "\n"; $fen = $token[0]; $game_num = $token[1]; print "\n";
$goat = "diagrams/game$game_num.png"; 
$src="ChessImager/ChessImager.php?fen=$fen&amp;amp;square_size=45&amp;amp;ds_color=(143,188,143)&amp;amp;ls_color=(232,223,192)";
echo "&lt;li&gt;&lt;img src = \"$src\"&gt;&lt;/li&gt;";}
?&gt;
</code></pre>

<p>Any ideas?</p>
