protected function checkReferrer()
    {
        if (! isset($_SERVER['HTTP_REFERER'])) {
            throw new ErrorException('Direct image manipulation is not allowed.');
        }

        $referrer = preg_replace('%^https?://%', '', $_SERVER['HTTP_REFERER']);
        if (! preg_match("%^{$_SERVER['SERVER_NAME']}%", $referrer)) {
            throw new ErrorException('Referrer does not match the correct domain.');
        }
    }
protected function checkReferrer()
    {
        if (! isset($_SERVER['HTTP_REFERER'])) {
            throw new ErrorException('Direct image manipulation is not allowed.');
        }

        $referrer = preg_replace('%^https?://%', '', $_SERVER['HTTP_REFERER']);
        if (! preg_match("%^{$_SERVER['SERVER_NAME']}%", $referrer)) {
            throw new ErrorException('Referrer does not match the correct domain.');
        }
    }
protected function checkReferrer ( ) { if ( ! isset ( $ _SERVER [ 'HTTP_REFERER' ] ) ) { throw new ErrorException ( 'Direct image manipulation is not allowed.' ) ; } $ referrer = preg_replace ( '%^https?://%' , '' , $ _SERVER [ 'HTTP_REFERER' ] ) ; if ( ! preg_match ( "%^{$_SERVER['SERVER_NAME']}%" , $ referrer ) ) { throw new ErrorException ( 'Referrer does not match the correct domain.' ) ; } }
Check to make sure the referrer domain is the same as the domain where the image exists.

@throws ErrorException
Check to make sure the referrer domain is the same as the domain where the image exists .