Skip to content

Commit

Permalink
Fixed gallerybehavior on localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
jirisvoboda committed Jun 21, 2016
1 parent 00efe05 commit 7825622
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions GalleryBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,18 @@ public function getImageFilePath($image_id, $version = self::VERSION_ORIGINAL)
{
$subDir = $this->getVersionSubDir($version, $image_id);

return implode(DIRECTORY_SEPARATOR, [
$path = implode(DIRECTORY_SEPARATOR, [
$this->directory,
$subDir,
$this->getFilePath($image_id, $version)
]);

if (!is_writable($path))
{
return $_SERVER['DOCUMENT_ROOT'].$path;
}

return $path;
}

/**
Expand Down Expand Up @@ -761,7 +768,12 @@ private function createFolder($filePath)

if (!$path)
{
mkdir($dirPath, 0777, true);
$result = @mkdir($dirPath, 0777, true);

if (!$result)
{
@mkdir($_SERVER['DOCUMENT_ROOT'].$dirPath, 0777, true);
}
}
}

Expand Down

0 comments on commit 7825622

Please sign in to comment.