title: pngquant PHP example isn't working
body: <p>I am trying to use the <a href="https://pngquant.org/" rel="nofollow noreferrer">pngquant</a> compression algorithm to compress PNG images on the fly using WAMP. They provide a <a href="https://pngquant.org/php.html" rel="nofollow noreferrer">PHP example</a> that (I think) is supposed to use the <a href="https://pngquant.org/pngquant-windows.zip" rel="nofollow noreferrer">command line binary for Windows</a>, which I have put in the <code>system32</code> folder and I can access from anywhere on the command line.</p>
  
  <p>I have taken their example and traced the problem to the <code>$compressed_png_content = shell_exec("pngquant --quality=$min_quality-$max_quality - &lt; ".escapeshellarg(    $path_to_png_file));</code> line. I have simplified it to <code>var_dump(shell_exec('pngquant - &lt; test.png'));</code> but it only outputs the first 5 characters even though <code>passthru('pngquant - &lt; test.png');</code> seems to send the correct output to the user as a string. <code>exec('pngquant - &lt; test.png',$output); var_dump($output);</code> also seems to capture the correct output but in a form of an array, which I don't really know how to convert back into an image file. I want to capture the output in a variable so I can use further compression algorithms and manipulations and send it to the user as a downloadable file.</p>
  
  <p>I have read up on the <a href="https://stackoverflow.com/a/21016100/2051323">diferences between system() vs exec() vs shell_exec() vs passthru() vs proc_open() vs popen()</a>. Shell_exec() seems to be the correct choice, however it says on php.net that <a href="http://php.net/manual/en/function.shell-exec.php" rel="nofollow noreferrer">shell_exec()'s</a> outputs a string. Could that be a problem? How do I correctly capture the <code>pngquant - &lt; test.png</code> command output to a variable?</p>