Cheetah
File.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Intervention\Image;
4 
5 class File
6 {
12  public $mime;
13 
19  public $dirname;
20 
26  public $basename;
27 
33  public $extension;
34 
40  public $filename;
41 
47  public function setFileInfoFromPath($path)
48  {
49  $info = pathinfo($path);
50  $this->dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null;
51  $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null;
52  $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null;
53  $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null;
54 
55  if (file_exists($path) && is_file($path)) {
56  $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
57  }
58 
59  return $this;
60  }
61 
67  public function filesize()
68  {
69  $path = $this->basePath();
70 
71  if (file_exists($path) && is_file($path)) {
72  return filesize($path);
73  }
74 
75  return false;
76  }
77 
78 }
Intervention\Image\File\setFileInfoFromPath
setFileInfoFromPath($path)
Definition: File.php:47
php
Intervention\Image\File\filesize
filesize()
Definition: File.php:67
Intervention\Image\File\$extension
$extension
Definition: File.php:33
Intervention\Image\File\$basename
$basename
Definition: File.php:26
$path
$path
Definition: header.inc.php:12
Intervention\Image\File\$mime
$mime
Definition: File.php:12
Intervention\Image\File\$filename
$filename
Definition: File.php:40
extension
Output TidyFormat such as indentation and wrap</p >< p > This can greatly improve readability for editors who are hand editing the but is by no means necessary as HTML Purifier has already fixed all major errors the HTML may have had Tidy is a non default extension
Definition: Output.TidyFormat.txt:14
Intervention\Image\File\$dirname
$dirname
Definition: File.php:19
File
Intervention\Image
Definition: AbstractColor.php:3