public function saveAllPagesAsImages($directory, $prefix = '')
    {
        $numberOfPages = $this->getNumberOfPages();

        if ($numberOfPages === 0) {
            return [];
        }

        return array_map(function ($pageNumber) use ($directory, $prefix) {
            $this->setPage($pageNumber);

            $destination = "{$directory}/{$prefix}{$pageNumber}.{$this->outputFormat}";

            $this->saveImage($destination);

            return $destination;
        }, range(1, $numberOfPages));
    }
public function saveAllPagesAsImages($directory, $prefix = '')
    {
        $numberOfPages = $this->getNumberOfPages();

        if ($numberOfPages === 0) {
            return [];
        }

        return array_map(function ($pageNumber) use ($directory, $prefix) {
            $this->setPage($pageNumber);

            $destination = "{$directory}/{$prefix}{$pageNumber}.{$this->outputFormat}";

            $this->saveImage($destination);

            return $destination;
        }, range(1, $numberOfPages));
    }
public function saveAllPagesAsImages ( $ directory , $ prefix = '' ) { $ numberOfPages = $ this -> getNumberOfPages ( ) ; if ( $ numberOfPages === 0 ) { return [ ] ; } return array_map ( function ( $ pageNumber ) use ( $ directory , $ prefix ) { $ this -> setPage ( $ pageNumber ) ; $ destination = "{$directory}/{$prefix}{$pageNumber}.{$this->outputFormat}" ; $ this -> saveImage ( $ destination ) ; return $ destination ; } , range ( 1 , $ numberOfPages ) ) ; }
Save the file as images to the given directory.

@param string $directory
@param string $prefix

@return array $files the paths to the created images
Save the file as images to the given directory .