示例#1
0
 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $img = new fastImage($file);
         $type = $img->getType();
         if ($type !== false) {
             $size = $img->getSize($file);
             if (is_array($size) && count($size)) {
                 $thumb_file = "{$thumbDir}/" . basename($file);
                 if (!is_file($thumb_file)) {
                     $this->makeThumb($file, false);
                 }
                 $smallThumb = $size[0] <= $this->config['thumbWidth'] && $size[1] <= $this->config['thumbHeight'] && in_array($type, array("gif", "jpeg", "png"));
             } else {
                 $smallThumb = false;
             }
         } else {
             $smallThumb = false;
         }
         $img->close();
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $name = basename($file);
         $ext = file::getExtension($file);
         $types = $this->config['types'];
         $types = explode(' ', $types['images'] . ' ' . $types['image']);
         if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) {
             continue;
         }
         if ($this->type == 'images' && !in_array(strtolower($ext), $types)) {
             continue;
         }
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $smallThumb);
     }
     return $return;
 }
示例#2
0
 protected function getFiles($dir)
 {
     $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/{$dir}";
     $dir = "{$this->config['uploadDir']}/{$dir}";
     $return = array();
     $files = dir::content($dir, array('types' => "file", 'not_pattern' => "/.*(?:-\\d{1,}x\\d{1,})\\..*/"));
     if ($files === false) {
         return $return;
     }
     foreach ($files as $file) {
         $img = new fastImage($file);
         $type = $img->getType();
         if ($type !== false) {
             $size = $img->getSize($file);
             if (is_array($size) && count($size)) {
                 $thumb_file = "{$thumbDir}/" . basename($file);
                 if (!is_file($thumb_file)) {
                     $this->makeThumb($file, false);
                 }
                 $smallThumb = $size[0] <= $this->config['thumbWidth'] && $size[1] <= $this->config['thumbHeight'] && in_array($size[2], array(IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG));
             } else {
                 $smallThumb = false;
             }
         } else {
             $smallThumb = false;
         }
         $img->close();
         $stat = stat($file);
         if ($stat === false) {
             continue;
         }
         $name = basename($file);
         $ext = file::getExtension($file);
         $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/{$ext}.png");
         $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/{$ext}.png");
         $thumb = file_exists("{$thumbDir}/{$name}");
         $return[] = array('name' => stripcslashes($name), 'size' => $stat['size'], 'mtime' => $stat['mtime'], 'date' => @strftime($this->dateTimeSmall, $stat['mtime']), 'readable' => is_readable($file), 'writable' => file::isWritable($file), 'bigIcon' => $bigIcon, 'smallIcon' => $smallIcon, 'thumb' => $thumb, 'smallThumb' => $smallThumb);
     }
     return $return;
 }