Attach the current image to new PSR-7 HTTP response
2.1M Downloads / Month
Open Source MIT License
public Intervention\Image\Image psrResponse([mixed $format, [int $quality]])
Encodes the current image in given format and given image quality and creates new PSR-7 HTTP response based on image data.
Define the encoding format from one of the following formats:
By default the method will return data encoded in the type of the current image. If no image type is defined yet, data will be encoded as jpeg.
Define the quality of the encoded image optionally. Data ranging from
0 (poor quality, small file) to
100 (best quality, big file). Quality is only applied if you're encoding JPG format since PNG compression is lossless and does not affect image quality. Default:
PSR-7 HTTP response as instance of
// encode png image as jpg stream $response = Image::make('public/foo.png')->psrResponse('jpg', 60);