All pastes #214226 Raw Edit

Mine

public text v1 · immutable
#214226 ·published 2006-10-21 22:26 UTC
rendered paste body
 function importnewimages(){
    $allowed_extensions = explode(",", $this->extensions);
    if (!$_REQUEST['list']) $_REQUEST['list'] = "1";
    if ($handle = opendir("pictures/")) {
      while (false !== ($file = readdir($handle))) {
        $fileInfo = pathinfo("pictures/" . $file);
        $extension = strtolower($fileInfo["extension"]);
	    if(!$this->inDB($file)){
		  $this->log("Importing '$file' (" . filesize("pictures/" . $file). " bytes)");
	      $imported++;
	      @chmod("pictures/" . $file,0644);
          $this->createthumb($file);
		  $this->log(" * finished creating thumbnails");
          $this->addnew($file,$_REQUEST['list']);
		  $this->log(" * finished adding file to database");
		  $this->log(" = finished importing '$file'");
        }
      }
    $this->write_iDB();
    closedir($handle);
	$this->updateDB();
    return $imported;
    }
  }