File indexing completed on 2025-01-26 05:29:13
0001 <?php 0002 0003 namespace Intervention\Image\Commands; 0004 0005 class StreamCommand extends AbstractCommand 0006 { 0007 /** 0008 * Builds PSR7 stream based on image data. Method uses Guzzle PSR7 0009 * implementation as easiest choice. 0010 * 0011 * @param \Intervention\Image\Image $image 0012 * @return boolean 0013 */ 0014 public function execute($image) 0015 { 0016 $format = $this->argument(0)->value(); 0017 $quality = $this->argument(1)->between(0, 100)->value(); 0018 0019 $this->setOutput(\GuzzleHttp\Psr7\stream_for( 0020 $image->encode($format, $quality)->getEncoded() 0021 )); 0022 0023 return true; 0024 } 0025 }