JBZoo\Utils\FS::dirname PHP Method

dirname() public static method

public static dirname ( string $path ) : string
$path string
return string
    public static function dirname($path)
    {
        return pathinfo($path, PATHINFO_DIRNAME);
    }

Usage Example

コード例 #1
0
ファイル: Image.php プロジェクト: JBZoo/Image
 /**
  * Save an image
  * The resulting format will be determined by the file extension.
  *
  * @param string   $filename If omitted - original file will be overwritten
  * @param null|int $quality  Output image quality in percents 0-100
  * @return $this
  *
  * @throws Exception
  */
 public function saveAs($filename, $quality = null)
 {
     if (!$filename) {
         throw new Exception('Empty filename to save image');
     }
     $dir = FS::dirname($filename);
     if (is_dir($dir)) {
         $this->_save($filename, $quality);
     } else {
         throw new Exception('Target directory "' . $dir . '" not exists');
     }
     return $this;
 }
All Usage Examples Of JBZoo\Utils\FS::dirname