dirname() 공개 정적인 메소드

public static dirname ( string $path ) : string
$path string
리턴 string
예제 #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;
 }
예제 #2
0
 public function testDirname()
 {
     isSame('.', FS::dirname('image.png'));
     isSame('.', FS::dirname('image.jpg.png'));
     isSame('/file/path', FS::dirname('/file/path/image.jpg.png'));
     isSame('.', FS::dirname('image'));
     isSame('', FS::dirname(''));
     isSame('', FS::dirname(null));
     isSame('', FS::dirname(false));
 }