return two-dimensional array with folders-list and images in specified $imgdr
970394
public function getMenuImgs() {
    $re = ['menu'=>'', 'imgs'=>''];
    try{
      $obdr = new DirectoryIterator($_SERVER['DOCUMENT_ROOT'] .'/'. $this->root . $this->imgdr);         // object of the dir
    }
    catch(Exception $e) {
      return '<h2>ERROR from PHP:</h2><h3>'. $e->getMessage() .'</h3><h4>Check the $root value in imgbrowse.php to see if it is the correct path to the image folder; RELATIVE TO ROOT OF YOUR WEBSITE ON SERVER</h4>';
    }

    // get protocol and host name to add absolute path in <img src>
    $protocol = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
    $site = $protocol. $_SERVER['SERVER_NAME'] .'/';

    // traverse the $obdr
    foreach($obdr as $fileobj) {
      $name = $fileobj->getFilename();

      // if image file, else, directory (but not . or ..), add data in $re
      if($fileobj->isFile() && in_array($fileobj->getExtension(), $this->imgext)) $re['imgs'] .= '<span><img src="'. $site . $this->root . $this->imgdr . $name .'" alt="'. $name .'" height="50" />'. $name .'</span>';
      else if($fileobj->isDir() && !$fileobj->isDot()) $re['menu'] .= '<li><span title="'. $this->imgdr . $name .'">'. $name .'</span></li>';
    }
    if($re['menu'] != '') $re['menu'] = '<ul>'. $re['menu'] .'</ul>';
    if($re['imgs'] == '') $re['imgs'] = '<h1>No Images</h1>';
    return $re;
  }
109173
private function getArchiveFiles(): array {

        $list = [];

        for ( $i = 0; $i < $this->getArchive()->numFiles; $i++ ) {

            $file = $this->getArchive()->statIndex($i);
            if ( $file === false ) {
                continue;
            }

            $name = str_replace('\\', '/', $file['name']);
            if (
                (
                    $name[0] == "." &&
                    in_array($this->getSkipMode(), ["HIDDEN", "ALL"])
                ) ||
                (
                    $name[0] == "." &&
                    @$name[1] == "_" &&
                    in_array($this->getSkipMode(), ["COMODOJO", "ALL"])
                )
            ) {
                continue;
            }

            $list[] = $name;

        }

        return $list;

    }
650677
def _list_images(self, root):
        
        self.labels = []
        self.items = []

        valid_unseen_sub_idx = [1, 2, 20, 22]
        skip_sub_idx = [21]

        if self._mode == 'train':
            sub_idx = ['s' + str(i) for i in range(1, 35) \
                             if i not in valid_unseen_sub_idx + skip_sub_idx]
        elif self._mode == 'valid':
            sub_idx = ['s' + str(i) for i in valid_unseen_sub_idx]

        folder_path = []
        for i in sub_idx:
            folder_path.extend(glob.glob(os.path.join(root, i, "*")))

        for folder in folder_path:
            filename = glob.glob(os.path.join(folder, "*"))
            if len(filename) != self._seq_len:
                continue
            filename.sort()
            label = os.path.split(folder)[-1]
            self.items.append((filename, label))
1073891
public static function getImageFromArray($data, $size, $dimensions = false)
    {
        if($dimensions === true)
        {
            $image = (object) [
                'url' => $data['sizes'][$size],
                'width' => $data['sizes'][$size . '-width'],
                'height' => $data['sizes'][$size . '-height']
            ];
        }
        else
        {
            $image = $data['sizes'][$size];
        }
        return $image;
    }
986845
def get_image_list(self, name, dir_structure='original'):
        
        assert name in ['train', 'val', 'test']
        assert dir_structure in ['original', 'train']
        add_label_to_fname = (name != 'train' and dir_structure != 'original')
        if add_label_to_fname:
            synset = self.get_synset_1000()

        fname = os.path.join(self.dir, name + '.txt')
        assert os.path.isfile(fname), fname
        with open(fname) as f:
            ret = []
            for line in f.readlines():
                name, cls = line.strip().split()
                cls = int(cls)

                if add_label_to_fname:
                    name = os.path.join(synset[cls], name)

                ret.append((name.strip(), cls))
        assert len(ret), fname
        return ret
36769
def image2array(image):
    
    nx, ny = image.shape  # find the size of the array
    imgh = np.reshape(image, nx*ny)  # change the shape to be 1d
    return imgh
1217429
function GetThumb($dir, $md5, $filename, $mode, $width = 100, $height = 100)
    {
        $path = realpath(DIR_ROOT . '/' . $dir);
        if (is_file($path . '/.thumbs/' . $md5 . '_' . $width . '_' . $height . '_' . $mode . '.jpg'))
        {
            return $dir . '/.thumbs/' . $md5 . '_' . $width . '_' . $height . '_' . $mode . '.jpg';
        }

        $t = new Image_Toolbox($path . '/' . $filename);
        $t->newOutputSize($width, $height, $mode, false, '#FFFFFF');
        $filename = '/.thumbs/' . $md5 . '_' . $width . '_' . $height . '_' . $mode . '.jpg';
        $t->save($path . $filename, 'jpg', 80);
        chmod($path . $filename, 0666);
        return $dir . $filename;
    }
664151
def getImgIds(self, imgIds=[], catIds=[]):
        '''
        
        '''
        imgIds = imgIds if _isArrayLike(imgIds) else [imgIds]
        catIds = catIds if _isArrayLike(catIds) else [catIds]

        if len(imgIds) == len(catIds) == 0:
            ids = self.imgs.keys()
        else:
            ids = set(imgIds)
            for i, catId in enumerate(catIds):
                if i == 0 and len(ids) == 0:
                    ids = set(self.catToImgs[catId])
                else:
                    ids &= set(self.catToImgs[catId])
        return list(ids)
445601
public static function listDir($dir = '.')
    {
        $list = [];
        foreach (scandir($dir) as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            } else {
                $list[] = self::fileInfo($dir . DS . $file);
            }
        }
        return $list;
    }
809015
def list_dir(self):
        

        bucket = self.blob.bucket
        prefix = self.blob.name
        if not prefix.endswith('/'): prefix += '/'

        for blob in bucket.list_blobs(prefix=prefix, delimiter='/'):
            yield 'gs://{}/{}'.format(blob.bucket.name, blob.name)
794480
function LinkImageSort($_by,$sby,$soby,$soby2,$stitle) {
   if($_by==$sby)
    return <<<EOF
  <a href="{$_SERVER['PHP_SELF']}?sort={$soby}&amp;by={$sby}" class="formfont" onmouseover="if(document.getElementById('so{$sby}')){ document.getElementById('so{$sby}').src='./swat4query/images/server_{$soby}.gif'; }" onmouseout="if(document.getElementById('so{$sby}')){ document.getElementById('so{$sby}').src='./swat4query/images/server_{$soby2}.gif'; }"><b>{$stitle}</b> <img src="./swat4query/images/server_{$soby2}.gif" width="11" height="9" border="0" alt="{$soby}" id="so{$sby}" />
EOF;
   else return '<a href="'.$_SERVER['PHP_SELF'].'?sort='.$soby.'&amp;by='.$sby.'" class="formfont"><b>'.$stitle.'</b>';
  }
675116
public static function listDirs($pDir)
    {
        if (substr($pDir, -1) !== DS) {
            $pDir .= DS;
        }

        $content = glob($pDir . '*', GLOB_ONLYDIR);
        if ($content === false) {
            return array();
        }

        $content = array_map(function($el) use ($pDir) {
            //return str_replace($pDir, '', $el);
            return $el . DS;
        }, $content);

        return $content;
    }
652555
def list_images(path=['.']):
    
    for image_dir in set(path):
        if not os.path.isdir(image_dir):
            continue
        for filename in os.listdir(image_dir):
            bname, ext = os.path.splitext(filename)
            if ext.lower() not in VALID_IMAGE_EXTS:
                continue

            filepath = os.path.join(image_dir, filename)
            yield strutils.decode(filepath)
1233159
static function searchdir($path,$mode = "FULL",$file_types = array(".html",".php"),$maxdepth = -1,$d = 0) {
	   if(substr($path,strlen($path)-1) != '/')
		   $path .= '/';
	   $dirlist = array();
	   if($mode != "FILES")
			$dirlist[] = $path;
	   if($handle = @opendir($path)) {
		   while(false !== ($file = readdir($handle)))
		   {
			   if($file != '.' && $file != '..')
			   {
				   $file = $path.$file ;
				   if(!is_dir($file))
				   {
						if($mode != "DIRS")
						{
							$extension = "";
							$extpos = strrpos($file, '.');
							if($extpos!==false)
								$extension = substr($file,$extpos,strlen($file)-$extpos);
							$extension=strtolower($extension);
							if(in_array($extension, $file_types))
								$dirlist[] = $file;
						}
				   }
				   elseif($d >= 0 && ($d < $maxdepth || $maxdepth < 0))
				   {
					   $result = self::searchdir($file.'/',$mode,$file_types,$maxdepth,$d + 1) ;
					   $dirlist = array_merge($dirlist,$result);
				   }
			   }
		   }
		   closedir ( $handle ) ;
	   }
	   if($d == 0)
		   natcasesort($dirlist);

	   return($dirlist) ;
	}
273576
def get_files(dir_name):
    """"""
    return [(os.path.join('.', d), [os.path.join(d, f) for f in files]) for d, _, files in os.walk(dir_name)]
127095
public function getImagesForSeo() {
		$result = new ArrayList();
		$pwis = $this->owner->AllChildren()->where("ClassName in (
			'PageWithImage','PageWithImagesFolder')");
		foreach ($pwis->getIterator() as $pwi) {
			if ($pwi->MainImageID > 0) {
				$result->push($pwi->MainImage());
			}
		}
		return $result;
	}
647830
function reArrayFiles(&$file_post) {

        $file_ary = array();
        $file_count = count($file_post['name']);
        $file_keys = array_keys($file_post);

        for ($i=0; $i<$file_count; $i++) {
            foreach ($file_keys as $key) {
                $file_ary[$i][$key] = $file_post[$key][$i];
            }
        }

        return $file_ary;
    }