src/Server.php
public function run()
    {
        // Catch all errors and convert to exceptions
        set_error_handler(array('\Diarmuidie\ImageRack\Server', 'handleErrors'));

        // Catch all uncaught exceptions
        set_exception_handler(array($this, 'error'));

        // Send a not found response if the request is not valid
        if (!$this->validRequest()) {
            $this->notFound();

            return $this->response;
        }

        // First try and load the image from the cache
        $cachePath = $this->getCachePath();
        if ($this->serveFromCache($cachePath)) {
            return $this->response;
        }

        // Secondly try load the source image
        $sourcePath = $this->getSourcePath();
        if ($this->serveFromSource($sourcePath)) {
            return $this->response;
        }

        // Finally default to returning a not found response
        $this->notFound();

        return $this->response;
    }
public function run()
    {
        // Catch all errors and convert to exceptions
        set_error_handler(array('\Diarmuidie\ImageRack\Server', 'handleErrors'));

        // Catch all uncaught exceptions
        set_exception_handler(array($this, 'error'));

        // Send a not found response if the request is not valid
        if (!$this->validRequest()) {
            $this->notFound();

            return $this->response;
        }

        // First try and load the image from the cache
        $cachePath = $this->getCachePath();
        if ($this->serveFromCache($cachePath)) {
            return $this->response;
        }

        // Secondly try load the source image
        $sourcePath = $this->getSourcePath();
        if ($this->serveFromSource($sourcePath)) {
            return $this->response;
        }

        // Finally default to returning a not found response
        $this->notFound();

        return $this->response;
    }
public function run ( ) { // Catch all errors and convert to exceptions set_error_handler ( array ( '\Diarmuidie\ImageRack\Server' , 'handleErrors' ) ) ; // Catch all uncaught exceptions set_exception_handler ( array ( $ this , 'error' ) ) ; // Send a not found response if the request is not valid if ( ! $ this -> validRequest ( ) ) { $ this -> notFound ( ) ; return $ this -> response ; } // First try and load the image from the cache $ cachePath = $ this -> getCachePath ( ) ; if ( $ this -> serveFromCache ( $ cachePath ) ) { return $ this -> response ; } // Secondly try load the source image $ sourcePath = $ this -> getSourcePath ( ) ; if ( $ this -> serveFromSource ( $ sourcePath ) ) { return $ this -> response ; } // Finally default to returning a not found response $ this -> notFound ( ) ; return $ this -> response ; }
Run the image Server on the curent request.

@return Response The response object
Run the image Server on the curent request .