private function transform(ServerRequestInterface $request, ResponseInterface $response, $transform)
    {
        $image = Image::fromString((string) $response->getBody());
        $hints = $this->getClientHints($request);

        if ($hints) {
            $image->setClientHints($hints);
            $response = $response->withHeader('Vary', implode(', ', $hints));
        }

        $image->transform($transform);

        $body = self::createStream($response->getBody());
        $body->write($image->getString());

        return $response
            ->withBody($body)
            ->withHeader('Content-Type', $image->getMimeType());
    }
private function transform(ServerRequestInterface $request, ResponseInterface $response, $transform)
    {
        $image = Image::fromString((string) $response->getBody());
        $hints = $this->getClientHints($request);

        if ($hints) {
            $image->setClientHints($hints);
            $response = $response->withHeader('Vary', implode(', ', $hints));
        }

        $image->transform($transform);

        $body = self::createStream($response->getBody());
        $body->write($image->getString());

        return $response
            ->withBody($body)
            ->withHeader('Content-Type', $image->getMimeType());
    }
private function transform ( ServerRequestInterface $ request , ResponseInterface $ response , $ transform ) { $ image = Image :: fromString ( ( string ) $ response -> getBody ( ) ) ; $ hints = $ this -> getClientHints ( $ request ) ; if ( $ hints ) { $ image -> setClientHints ( $ hints ) ; $ response = $ response -> withHeader ( 'Vary' , implode ( ', ' , $ hints ) ) ; } $ image -> transform ( $ transform ) ; $ body = self :: createStream ( $ response -> getBody ( ) ) ; $ body -> write ( $ image -> getString ( ) ) ; return $ response -> withBody ( $ body ) -> withHeader ( 'Content-Type' , $ image -> getMimeType ( ) ) ; }
Transform the image.

@param ServerRequestInterface $request
@param ResponseInterface      $response
@param string                 $transform

@return ResponseInterface
Transform the image .