#!/usr/bin/php prepare("DROP TABLE image"); if ($stm) $stm->execute(); $dbh->prepare("CREATE TABLE image( iid INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, w INTEGER, h INTEGER)")->execute(); $stm=$dbh->prepare("INSERT INTO image(name,w,h) VALUES(?,?,?)"); chdir("../img"); $dh=opendir("."); while( ($file = readdir($dh)) !== false) { if (($file == ".") || ($file == "..")) continue; $im=getimagesize($file); echo "$file : " . $im[0]."x".$im[1]."\n"; $stm->execute(array($file,$im[0],$im[1])); } closedir($dh); ?>