private function sendCachingHeaders(string $imagePath = ''): void
    {
        $ifModifiedSince = '';
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
            $ifModifiedSince = \preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
        }

        $mdate = \gmdate('D, d M Y H:i:s', \filemtime($imagePath)).' GMT';
        if ($ifModifiedSince == $mdate) {
            \header($this->serverProtocol.' 304 Not Modified', true, 304);
            die();
        }

        \header($this->serverProtocol.' 200 OK', true, 200);
        \header('Last-Modified: '.$mdate);

        $maxAge = $this->baseClass->Image->Server->cacheTime;
        $maxAgeHeader = 'Cache-Control: no-transform,public,max-age='.$maxAge;
        if ($maxAge == 0) {
            $maxAgeHeader = 'Cache-Control: max-age=0, no-cache, no-store';
        }

        \header($maxAgeHeader);
        \header('Expires: '.\gmdate('D, d M Y H:i:s', \time() + $maxAge).' GMT');
    }