Exemple #1
0
 public function getFiles()
 {
     $return = [];
     $exclude = array('..', '.', '.DS_Store', '.git', '.gitignore', '.idea');
     $array = array_diff(scandir($this->path), $exclude);
     foreach ($array as $item) {
         $path = $this->path . DIRECTORY_SEPARATOR . $item;
         if (FileSystem::isDirectory($path)) {
             $return[] = new Directory($path);
         } else {
             if (FileSystem::isImage($path)) {
                 $return[] = new Image($path);
             } else {
                 if (FileSystem::isFile($path)) {
                     $return[] = new File($path);
                 }
             }
         }
     }
     return $return;
 }
Exemple #2
0
 private function prepare()
 {
     if (FileSystem::exists($this->path) && FileSystem::isImage($this->path)) {
         $image_properties = getimagesize($this->path);
         $this->originalWidth = $image_properties[0];
         $this->originalHeight = $image_properties[1];
         $this->resizeRatio = $this->originalWidth / $this->originalHeight;
         $this->imageType = $image_properties["mime"];
         if ($this->height === null) {
             $this->height = $this->originalHeight;
         }
         if ($this->width === null) {
             $this->width = $this->originalWidth;
         }
     }
 }