2 /* The SQLite extension is enabled by default as of PHP 5.
3 * Before that time the SQLite library is needed.
5 * For more info on setting up SQLite See:
6 * http://www.php.net/manual/en/sqlite.installation.php
9 if ($db = new SQLiteDatabase('imgorg.db')) {
11 // $db->queryExec('DROP TABLE Albums');
12 $db->queryExec('CREATE TABLE Albums (
13 id INTEGER PRIMARY KEY,
18 INSERT INTO Albums (text) VALUES ("Test");
19 INSERT INTO Albums (text) VALUES ("Album2");');
22 // $db->queryExec('DROP TABLE Albums_Images');
23 $db->queryExec('CREATE TABLE Albums_Images (
29 $db->queryExec('CREATE TABLE Images_Tags (
35 // $db->queryExec('DROP Table Tags');
36 $db->queryExec('CREATE TABLE Tags (
37 id INTEGER PRIMARY KEY,
40 INSERT INTO Tags (text) VALUES("Family");
41 INSERT INTO Tags (text) VALUES("Friends");
42 INSERT INTO Tags (text) VALUES("Other")');
45 // $db->queryExec('DROP TABLE Images');
46 $db->queryExec('CREATE TABLE Images (
47 id INTEGER PRIMARY KEY,
54 // $dir = "../../images/thumbs/";
58 // while($name = $d->read()){
59 // if(!preg_match('/\.(jpg|gif|png)$/', $name)) continue;
60 // $size = filesize($dir.$name);
61 // $lastmod = filemtime($dir.$name)*1000;
62 // $db->queryExec('INSERT INTO Images (filename, url) VALUES
63 // ("'.$name.'","images/thumbs/'.$name.'")');
68 echo json_encode($db->query('select * from Images')->fetchAll());