src/ResponseFactory.php
public function getResponse(MessageInterface $request, ImageResource $resource)
    {
        $version = $request->getProtocolVersion();
        $etag    = $request->getHeaderLine('if-none-match');

        list($time, $lastMod, $mod, $modDate) = $this->getModTimes($request, $resource);
        $headers = $this->getDefaultHeaders($lastMod, $resource->getHash());

        if (0 === strcmp($etag, $headers['etag']) ||
            // not modified response
            (($resource instanceof CachedResourceInterface &&
            $resource->isFresh($time)) && $mod === $modDate)) {
            $response = (new NotModifiedImageResonse($resource, [], $version))
                ->withHeader('content-type', $resource->getMimeType())
                ->withHeader('cache-control', 'public');
        } else {
            // normal response
            if ($this->useXsend && !empty($request->getHeaderLine('x-sendfile-type'))) {
                $headers = $this->getXsendfileHeaders($resource, $headers);
            }

            $response = new ImageResponse($resource, $headers, $version);
        }

        return $response;
    }
public function getResponse(MessageInterface $request, ImageResource $resource)
    {
        $version = $request->getProtocolVersion();
        $etag    = $request->getHeaderLine('if-none-match');

        list($time, $lastMod, $mod, $modDate) = $this->getModTimes($request, $resource);
        $headers = $this->getDefaultHeaders($lastMod, $resource->getHash());

        if (0 === strcmp($etag, $headers['etag']) ||
            // not modified response
            (($resource instanceof CachedResourceInterface &&
            $resource->isFresh($time)) && $mod === $modDate)) {
            $response = (new NotModifiedImageResonse($resource, [], $version))
                ->withHeader('content-type', $resource->getMimeType())
                ->withHeader('cache-control', 'public');
        } else {
            // normal response
            if ($this->useXsend && !empty($request->getHeaderLine('x-sendfile-type'))) {
                $headers = $this->getXsendfileHeaders($resource, $headers);
            }

            $response = new ImageResponse($resource, $headers, $version);
        }

        return $response;
    }
{@inheritdoc}