Using passthru() to Output Binary Data : passthru « Utility Function « PHP






Using passthru() to Output Binary Data

 
<?php
if ( isset( $_REQUEST['image'] ) && file_exists( $_REQUEST['image'] ) ) {
  header( "Content-type: image/gif" );
  $image = $_REQUEST['image'];
  passthru(  "giftopnm $image |
        pnmscale -xscale .5 -yscale .5 |
        ppmquant 256 | ppmtogif" );
} else {
  print "The image ".$_REQUEST['image']." could not be found";
}
?>
  
  








Related examples in the same category

1.Using the PHP passthru() Function
2.void passthru ( string command [, int &return_var] ) runs an external program
3.passthru() function works like exec(), except that the command output is automatically output.