All pastes #214332 Raw Edit

Untitled

public text v1 · immutable
#214332 ·published 2006-10-21 23:56 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)  &&  strpos($file, "_thumb") === false){
                  $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;
    }
  }