rendered paste bodyclass ImageSearch{
protected $search = true;
public function search($path){
$this->search = true;
$found = array();
if (!$this->gather($path,$found)) {
return false;
}else{
return $found;
}
}
public function cancel(){
$this->search = false;
}
protected function gather($path,&$found){
$dir = new DirectoryIterator($path);
foreach ($dir as $file){
while(Gtk::events_pending()) Gtk::main_iteration();
if ($file->isFile() & !$file->isDot() & !$file->isDir()) {
$found[] = array($file->getFilename(),$file->getPath());
}
if (!$file->isDot() & $file->isDir()) {
find_images($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename(),$found);
}
if ($this->search == false) {
return false;
}
}
return true;
}
}