squeezr/lib/Tollwerk/Squeezr.php
/**
     * Send a file along with it's appropriate headers
     *
     * @param string $src File path
     * @param string $mime MIME type
     * @param boolean $cache Optional: The client browser should cache the file
     * @return void
     */
Send a file along with it's appropriate headers
@param string $src File path
@param string $mime MIME type
@param boolean $cache Optional: The client browser should cache the file
@return void
Send a file along with it ' s appropriate headers @param string $src File path @param string $mime MIME type @param boolean $cache Optional : The client browser should cache the file @return void
protected function _sendFile($src, $mime, $cache = true)
    {
        foreach ($this->_headers as $header => $value) {
            header($header.': '.$value);
        }
        header('Content-Type: '.$mime);
        header('Content-Length: '.filesize(@is_link($src) ? @readlink($src) : $src));
        if ($cache) {
            header('Cache-Control: private, max-age='.SQUEEZR_CACHE_LIFETIME);
            header('Expires: '.gmdate('D, d M Y H:i:s', time() + SQUEEZR_CACHE_LIFETIME).' GMT');
            header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($src)).' GMT');
            header('ETag: '.$this->_calculateFileETag($src));
        } else {
            header('Cache-Control: no-cache, must-revalidate');
            header('Expires: '.gmdate('D, d M Y H:i:s', time() - SQUEEZR_CACHE_LIFETIME).' GMT');
        }
        readfile($src);
        exit;
    }
protected function _sendFile ( $ src , $ mime , $ cache = true ) { foreach ( $ this -> _headers as $ header => $ value ) { header ( $ header . ': ' . $ value ) ; } header ( 'Content-Type: ' . $ mime ) ; header ( 'Content-Length: ' . filesize ( @ is_link ( $ src ) ? @ readlink ( $ src ) : $ src ) ) ; if ( $ cache ) { header ( 'Cache-Control: private, max-age=' . SQUEEZR_CACHE_LIFETIME ) ; header ( 'Expires: ' . gmdate ( 'D, d M Y H:i:s' , time ( ) + SQUEEZR_CACHE_LIFETIME ) . ' GMT' ) ; header ( 'Last-Modified: ' . gmdate ( 'D, d M Y H:i:s' , filemtime ( $ src ) ) . ' GMT' ) ; header ( 'ETag: ' . $ this -> _calculateFileETag ( $ src ) ) ; } else { header ( 'Cache-Control: no-cache, must-revalidate' ) ; header ( 'Expires: ' . gmdate ( 'D, d M Y H:i:s' , time ( ) - SQUEEZR_CACHE_LIFETIME ) . ' GMT' ) ; } readfile ( $ src ) ; exit ; }
Send a file along with it's appropriate headers
 @param string $src File path
 @param string $mime MIME type
 @param boolean $cache Optional: The client browser should cache the file
 @return void
Send a file along with it ' s appropriate headers @param string $src File path @param string $mime MIME type @param boolean $cache Optional : The client browser should cache the file @return void
// Custom headers // Send basic headers // If the client browser should cache the image // Else