Skip to content

Commit

Permalink
Added options in setOutputDirectory
Browse files Browse the repository at this point in the history
Added $mode and $recursive options in setOutputDirectory().
Otherwise, nested folders cannot be created. See: https://www.php.net/manual/en/function.mkdir.php
  • Loading branch information
hvallieri authored Feb 12, 2020
1 parent 5d85a3e commit f33a64a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/HeadlessChrome.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,13 @@ public function setUrl($url) {
/**
* Set the directory for render output (PDF / Screenshot)
* @param String $directory
* @param int $mode
* @param bool $recursive
*/
public function setOutputDirectory($directory)
public function setOutputDirectory($directory, $mode = 0777, $recursive = false)
{
if (!file_exists($directory) || !realpath($directory)) {
@mkdir($directory);
@mkdir($directory, $mode, $recursive);
}
$this->outputDirectory = realpath(trim($directory));
}
Expand Down

0 comments on commit f33a64a

Please sign in to comment.