File::dirname PHP Method

dirname() public static method

Extract the parent directory from a file path.
public static dirname ( string $path ) : string
$path string
return string
        public static function dirname($path)
        {
            return \Illuminate\Filesystem\Filesystem::dirname($path);
        }

Usage Example

Example #1
0
 public function index($rule, $file)
 {
     $config = config('imagine.rules.' . $rule, false);
     if (!$config) {
         throw new \Exception(sprintf('Imagine rule "%s" not exists', $rule));
     }
     $route = public_path(substr(route('cache.imagine', func_get_args(), false), 1));
     if (\File::exists($route)) {
         return \Image::make(public_path($route))->response();
     }
     if (!\File::exists($dir = \File::dirname($route))) {
         \File::makeDirectory($dir, 0777, true);
     }
     $image = \Image::make(public_path($file));
     $imagine = new ImagineProcess($image);
     $imagine->call($config);
     return $image->save($route)->response();
 }
All Usage Examples Of File::dirname