public function listCrops($path) {

        // Get the filename and dir
        $filename = basename($path);
        $dir = dirname($path);
        if ($dir === '.') $dir = ''; // Flysystem doesn't like "." for the dir

        // Filter the files in the dir to just crops of the image path
        return $this->justPaths(array_filter($this->getCropsDisk()->listContents($dir),
            function($file) use ($filename) {

            // Don't return the source image, we're JUST getting crops
            return $file['basename'] != $filename

            // Test that the crop begins with the src's path, that the crop is FOR
            // the src
            && strpos($file['basename'], pathinfo($filename, PATHINFO_FILENAME)) === 0

            // Make sure that the crop matches that Croppa file regex
            && preg_match('#'.URL::PATTERN.'#', $file['path']);
        }));
    }
public function listCrops($path) {

        // Get the filename and dir
        $filename = basename($path);
        $dir = dirname($path);
        if ($dir === '.') $dir = ''; // Flysystem doesn't like "." for the dir

        // Filter the files in the dir to just crops of the image path
        return $this->justPaths(array_filter($this->getCropsDisk()->listContents($dir),
            function($file) use ($filename) {

            // Don't return the source image, we're JUST getting crops
            return $file['basename'] != $filename

            // Test that the crop begins with the src's path, that the crop is FOR
            // the src
            && strpos($file['basename'], pathinfo($filename, PATHINFO_FILENAME)) === 0

            // Make sure that the crop matches that Croppa file regex
            && preg_match('#'.URL::PATTERN.'#', $file['path']);
        }));
    }
public function listCrops ( $ path ) { // Get the filename and dir $ filename = basename ( $ path ) ; $ dir = dirname ( $ path ) ; if ( $ dir === '.' ) $ dir = '' ; // Flysystem doesn't like "." for the dir // Filter the files in the dir to just crops of the image path return $ this -> justPaths ( array_filter ( $ this -> getCropsDisk ( ) -> listContents ( $ dir ) , function ( $ file ) use ( $ filename ) { // Don't return the source image, we're JUST getting crops return $ file [ 'basename' ] != $ filename // Test that the crop begins with the src's path, that the crop is FOR // the src && strpos ( $ file [ 'basename' ] , pathinfo ( $ filename , PATHINFO_FILENAME ) ) === 0 // Make sure that the crop matches that Croppa file regex && preg_match ( '#' . URL :: PATTERN . '#' , $ file [ 'path' ] ) ; } ) ) ; }
Find all the crops that have been generated for a src path

@param  string $path Path to a src image
@return array
Find all the crops that have been generated for a src path