Mega Code Archive

 
Categories / Php / Functions
 

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"; } ?>