public function render($request_path) {

        // Get crop path relative to it's dir
        $crop_path = $this->url->relativePath($request_path);

        // If the crops_dir is a remote disk and if the crop has already been
        // created.  If it has, just return that path.
        if ($this->storage->cropsAreRemote()
            && $this->storage->cropExists($crop_path)) {
            return $crop_path;
        }

        // Parse the path.  In the case there is an error (the pattern on the route
        // SHOULD have caught all errors with the pattern) just return
        if (!$params = $this->url->parse($request_path)) return;
        list($path, $width, $height, $options) = $params;

        // Check if there are too many crops already
        if ($this->storage->tooManyCrops($path)) throw new Exception('Croppa: Max crops');

        // Increase memory limit, cause some images require a lot to resize
        if ($this->config['memory_limit'] !== null) {
            ini_set('memory_limit', $this->config['memory_limit']);
        }

        // Build a new image using fetched image data
        $image = new Image(
            $this->storage->readSrc($path),
            $this->url->phpThumbConfig($options)
        );

        // Process the image and write its data to disk
        $this->storage->writeCrop($crop_path,
            $image->process($width, $height, $options)->get()
        );

        // Return the paht to the crop, relative to the storage disk
        return $crop_path;
    }
public function render($request_path) {

        // Get crop path relative to it's dir
        $crop_path = $this->url->relativePath($request_path);

        // If the crops_dir is a remote disk and if the crop has already been
        // created.  If it has, just return that path.
        if ($this->storage->cropsAreRemote()
            && $this->storage->cropExists($crop_path)) {
            return $crop_path;
        }

        // Parse the path.  In the case there is an error (the pattern on the route
        // SHOULD have caught all errors with the pattern) just return
        if (!$params = $this->url->parse($request_path)) return;
        list($path, $width, $height, $options) = $params;

        // Check if there are too many crops already
        if ($this->storage->tooManyCrops($path)) throw new Exception('Croppa: Max crops');

        // Increase memory limit, cause some images require a lot to resize
        if ($this->config['memory_limit'] !== null) {
            ini_set('memory_limit', $this->config['memory_limit']);
        }

        // Build a new image using fetched image data
        $image = new Image(
            $this->storage->readSrc($path),
            $this->url->phpThumbConfig($options)
        );

        // Process the image and write its data to disk
        $this->storage->writeCrop($crop_path,
            $image->process($width, $height, $options)->get()
        );

        // Return the paht to the crop, relative to the storage disk
        return $crop_path;
    }
public function render ( $ request_path ) { // Get crop path relative to it's dir $ crop_path = $ this -> url -> relativePath ( $ request_path ) ; // If the crops_dir is a remote disk and if the crop has already been // created.  If it has, just return that path. if ( $ this -> storage -> cropsAreRemote ( ) && $ this -> storage -> cropExists ( $ crop_path ) ) { return $ crop_path ; } // Parse the path.  In the case there is an error (the pattern on the route // SHOULD have caught all errors with the pattern) just return if ( ! $ params = $ this -> url -> parse ( $ request_path ) ) return ; list ( $ path , $ width , $ height , $ options ) = $ params ; // Check if there are too many crops already if ( $ this -> storage -> tooManyCrops ( $ path ) ) throw new Exception ( 'Croppa: Max crops' ) ; // Increase memory limit, cause some images require a lot to resize if ( $ this -> config [ 'memory_limit' ] !== null ) { ini_set ( 'memory_limit' , $ this -> config [ 'memory_limit' ] ) ; } // Build a new image using fetched image data $ image = new Image ( $ this -> storage -> readSrc ( $ path ) , $ this -> url -> phpThumbConfig ( $ options ) ) ; // Process the image and write its data to disk $ this -> storage -> writeCrop ( $ crop_path , $ image -> process ( $ width , $ height , $ options ) -> get ( ) ) ; // Return the paht to the crop, relative to the storage disk return $ crop_path ; }
Render image directly

@param string $request_path The `Request::path()`
@return string The path, relative to the storage disk, to the crop
Render image directly