本文整理汇总了PHP中Intervention\Image\Image::stream方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::stream方法的具体用法?PHP Image::stream怎么用?PHP Image::stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Intervention\Image\Image
的用法示例。
在下文中一共展示了Image::stream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Builds PSR7 compatible response. May replace "response" command in
* some future.
*
* Method will generate binary stream and put it inside PSR-7
* ResponseInterface. Following code can be optimized using native php
* streams and more "clean" streaming, however drivers has to be updated
* first.
*
* @param \Intervention\Image\Image $image
* @return boolean
*/
public function execute($image)
{
$format = $this->argument(0)->value();
$quality = $this->argument(1)->between(0, 100)->value();
//Encoded property will be populated at this moment
$stream = $image->stream($format, $quality);
$mimetype = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $image->getEncoded());
$this->setOutput(new Response(200, array('Content-Type' => $mimetype, 'Content-Length' => strlen($image->getEncoded())), $stream));
return true;
}
示例2: getImage
public function getImage($format = null, $quality = 90)
{
return $this->image->stream($format, $quality);
}