+++ /dev/null
-CREATE TABLE ansel_images (
- image_id INT NOT NULL,
- gallery_id INT NOT NULL,
- image_filename VARCHAR(255) NOT NULL,
- image_type VARCHAR(100) NOT NULL,
- image_caption TEXT,
- image_uploaded_date INT NOT NULL,
- image_sort INT NOT NULL,
- image_faces INT DEFAULT 0 NOT NULL,
- image_original_date INT NOT NULL,
- image_latitude VARCHAR(32),
- image_longitude VARCHAR(32),
- image_location VARCHAR(255),
- image_geotag_date INT,
---
- PRIMARY KEY (image_id)
-);
-CREATE INDEX ansel_images_gallery_idx ON ansel_images (gallery_id);
-CREATE INDEX ansel_images_gallery_image_idx ON ansel_images (image_id, gallery_id);
-CREATE INDEX ansel_images_uploaded_idx ON ansel_images (image_uploaded_date);
-CREATE INDEX ansel_images_taken_idx ON ansel_images (image_uploaded_date);
-
-CREATE TABLE ansel_image_attributes (
- image_id INT NOT NULL,
- attr_name VARCHAR(50) NOT NULL,
- attr_value VARCHAR(255),
---
- PRIMARY KEY (image_id, attr_name)
-);
-CREATE INDEX ansel_image_attributes_image_idx ON ansel_image_attributes (image_id);
-
-CREATE TABLE ansel_faces (
- face_id INT NOT NULL,
- image_id INT NOT NULL,
- gallery_id INT NOT NULL,
- face_name VARCHAR(255) NOT NULL,
- face_x1 INT NOT NULL,
- face_y1 INT NOT NULL,
- face_x2 INT NOT NULL,
- face_y2 INT NOT NULL,
- face_signature BYTEA,
---
- PRIMARY KEY (face_id)
-);
-
-CREATE TABLE ansel_faces_index (
- face_id INT NOT NULL,
- index_position INT NOT NULL,
- index_part BYTEA
-);
-CREATE INDEX ansel_faces_index_face_id_idx ON ansel_faces_index (face_id);
-CREATE INDEX ansel_faces_index_index_part_idx ON ansel_faces_index (index_part);
-CREATE INDEX ansel_faces_index_index_position_idx ON ansel_faces_index (index_position);
-
-CREATE TABLE ansel_shares (
- share_id INT NOT NULL,
- share_owner VARCHAR(255) NOT NULL,
- share_parents VARCHAR(255) NULL,
- perm_creator SMALLINT NOT NULL,
- perm_default SMALLINT NOT NULL,
- perm_guest SMALLINT NOT NULL,
- share_flags SMALLINT DEFAULT 0 NOT NULL,
- attribute_name VARCHAR(255) NOT NULL,
- attribute_desc TEXT,
- attribute_default INT,
- attribute_default_type VARCHAR(6),
- attribute_default_prettythumb TEXT,
- attribute_style VARCHAR(255),
- attribute_category VARCHAR(255) DEFAULT '' NOT NULL,
- attribute_last_modified INT,
- attribute_date_created INT,
- attribute_images INT DEFAULT 0 NOT NULL,
- attribute_has_subgalleries INT DEFAULT 0 NOT NULL,
- attribute_slug VARCHAR(255),
- attribute_age INT DEFAULT 0 NOT NULL,
- attribute_download VARCHAR(255),
- attribute_passwd VARCHAR(255),
- attribute_faces INT DEFAULT 0 NOT NULL,
- attribute_view_mode VARCHAR(255) DEFAULT 'Normal' NOT NULL,
---
- PRIMARY KEY (share_id)
-);
-CREATE INDEX ansel_shares_share_owner_idx ON ansel_shares (share_owner);
-CREATE INDEX ansel_shares_perm_creator_idx ON ansel_shares (perm_creator);
-CREATE INDEX ansel_shares_perm_default_idx ON ansel_shares (perm_default);
-CREATE INDEX ansel_shares_perm_guest_idx ON ansel_shares (perm_guest);
-CREATE INDEX ansel_shares_attribute_category_idx ON ansel_shares (attribute_category);
-CREATE INDEX ansel_shares_share_parents_idx ON ansel_shares (share_parents);
-
-CREATE TABLE ansel_shares_groups (
- share_id INT NOT NULL,
- group_uid VARCHAR(255) NOT NULL,
- perm SMALLINT NOT NULL
-);
-CREATE INDEX ansel_shares_groups_share_id_idx ON ansel_shares_groups (share_id);
-CREATE INDEX ansel_shares_groups_group_uid_idx ON ansel_shares_groups (group_uid);
-CREATE INDEX ansel_shares_groups_perm_idx ON ansel_shares_groups (perm);
-
-
-CREATE TABLE ansel_shares_users (
- share_id INT NOT NULL,
- user_uid VARCHAR(255) NOT NULL,
- perm SMALLINT NOT NULL
-);
-CREATE INDEX ansel_shares_users_share_id_idx ON ansel_shares_users (share_id);
-CREATE INDEX ansel_shares_users_user_uid_idx ON ansel_shares_users (user_uid);
-CREATE INDEX ansel_shares_users_perm_idx ON ansel_shares_users (perm);
-CREATE TABLE ansel_tags (
- tag_id INT NOT NULL,
- tag_name VARCHAR(255) NOT NULL,
-
- PRIMARY KEY (tag_id)
-);
-
-CREATE TABLE ansel_galleries_tags (
- gallery_id INT NOT NULL,
- tag_id INT NOT NULL,
---
- PRIMARY KEY (gallery_id, tag_id)
-);
-
-CREATE TABLE ansel_images_tags (
- image_id INT NOT NULL,
- tag_id INT NOT NULL,
---
- PRIMARY KEY (image_id, tag_id)
-);
-
-CREATE TABLE ansel_images_geolocation (
- image_id INT NOT NULL,
- image_latitude VARCHAR(32),
- image_longitude VARCHAR(32),
- image_location VARCHAR(255),
---
- PRIMARY KEY (image_id)
-);
-
-CREATE TABLE ansel_datatree_transition (
- datatree_id INT NOT NULL,
- image_id INT NOT NULL,
- vfsname VARCHAR(255) NOT NULL
-);
+++ /dev/null
-CREATE TABLE ansel_images (
- image_id INT NOT NULL,
- gallery_id INT NOT NULL,
- image_filename VARCHAR(255) NOT NULL,
- image_type VARCHAR(100) NOT NULL,
- image_caption TEXT,
- image_uploaded_date INT NOT NULL,
- image_sort INT NOT NULL,
- image_faces INT DEFAULT 0 NOT NULL,
- image_original_date INT NOT NULL,
- image_latitude VARCHAR(32),
- image_longitude VARCHAR(32),
- image_location VARCHAR(255),
- image_geotag_date INT,
---
- PRIMARY KEY (image_id)
-);
-CREATE INDEX ansel_images_gallery_idx ON ansel_images (gallery_id);
-CREATE INDEX ansel_images_gallery_image_idx ON ansel_images (image_id, gallery_id);
-CREATE INDEX ansel_images_uploaded_idx ON ansel_images (image_uploaded_date);
-CREATE INDEX ansel_images_taken_idx ON ansel_images (image_original_date);
-
-CREATE TABLE ansel_image_attributes (
- image_id INT NOT NULL,
- attr_name VARCHAR(50) NOT NULL,
- attr_value VARCHAR(255),
---
- PRIMARY KEY (image_id, attr_name)
-);
-CREATE INDEX ansel_image_attributes_image_idx ON ansel_image_attributes (image_id);
-
-CREATE TABLE ansel_faces (
- face_id INT NOT NULL,
- image_id INT NOT NULL,
- gallery_id INT NOT NULL,
- face_name VARCHAR(255) NOT NULL,
- face_x1 INT NOT NULL,
- face_y1 INT NOT NULL,
- face_x2 INT NOT NULL,
- face_y2 INT NOT NULL,
- face_signature BLOB,
---
- PRIMARY KEY (face_id)
-);
-
-CREATE INDEX ansel_faces_index_index_image_idx ON ansel_faces (image_id);
-CREATE INDEX ansel_faces_index_index_gallery_idx ON ansel_faces (gallery_id);
-
-CREATE TABLE ansel_faces_index (
- face_id INT NOT NULL,
- index_position INT NOT NULL,
- index_part BLOB
-);
-CREATE INDEX ansel_faces_index_face_id_idx ON ansel_faces_index (face_id);
-CREATE INDEX ansel_faces_index_index_part_idx ON ansel_faces_index (index_part (30));
-CREATE INDEX ansel_faces_index_index_position_idx ON ansel_faces_index (index_position);
-
-CREATE TABLE ansel_shares (
- share_id INT NOT NULL,
- share_owner VARCHAR(255) NOT NULL,
- share_parents VARCHAR(255) NULL,
- perm_creator SMALLINT NOT NULL,
- perm_default SMALLINT NOT NULL,
- perm_guest SMALLINT NOT NULL,
- share_flags SMALLINT DEFAULT 0 NOT NULL,
- attribute_name VARCHAR(255) NOT NULL,
- attribute_desc TEXT,
- attribute_default INT,
- attribute_default_type VARCHAR(6),
- attribute_default_prettythumb TEXT,
- attribute_style TEXT,
- attribute_category VARCHAR(255) DEFAULT '' NOT NULL,
- attribute_last_modified INT,
- attribute_date_created INT,
- attribute_images INT DEFAULT 0 NOT NULL,
- attribute_has_subgalleries INT DEFAULT 0 NOT NULL,
- attribute_slug VARCHAR(255),
- attribute_age INT DEFAULT 0 NOT NULL,
- attribute_download VARCHAR(255),
- attribute_passwd VARCHAR(255),
- attribute_faces INT DEFAULT 0 NOT NULL,
- attribute_view_mode VARCHAR(255) DEFAULT 'Normal' NOT NULL,
---
- PRIMARY KEY (share_id)
-);
-CREATE INDEX ansel_shares_share_owner_idx ON ansel_shares (share_owner);
-CREATE INDEX ansel_shares_perm_creator_idx ON ansel_shares (perm_creator);
-CREATE INDEX ansel_shares_perm_default_idx ON ansel_shares (perm_default);
-CREATE INDEX ansel_shares_perm_guest_idx ON ansel_shares (perm_guest);
-CREATE INDEX ansel_shares_attribute_category_idx ON ansel_shares (attribute_category);
-CREATE INDEX ansel_shares_share_parents_idx ON ansel_shares (share_parents);
-
-CREATE TABLE ansel_shares_groups (
- share_id INT NOT NULL,
- group_uid INT NOT NULL,
- perm SMALLINT NOT NULL
-);
-CREATE INDEX ansel_shares_groups_share_id_idx ON ansel_shares_groups (share_id);
-CREATE INDEX ansel_shares_groups_group_uid_idx ON ansel_shares_groups (group_uid);
-CREATE INDEX ansel_shares_groups_perm_idx ON ansel_shares_groups (perm);
-
-
-CREATE TABLE ansel_shares_users (
- share_id INT NOT NULL,
- user_uid VARCHAR(255) NOT NULL,
- perm SMALLINT NOT NULL
-);
-CREATE INDEX ansel_shares_users_share_id_idx ON ansel_shares_users (share_id);
-CREATE INDEX ansel_shares_users_user_uid_idx ON ansel_shares_users (user_uid);
-CREATE INDEX ansel_shares_users_perm_idx ON ansel_shares_users (perm);
-CREATE TABLE ansel_tags (
- tag_id INT NOT NULL,
- tag_name VARCHAR(255) NOT NULL,
-
- PRIMARY KEY (tag_id)
-);
-
-CREATE TABLE ansel_galleries_tags (
- gallery_id INT NOT NULL,
- tag_id INT NOT NULL,
---
- PRIMARY KEY (gallery_id, tag_id)
-);
-
-CREATE TABLE ansel_images_tags (
- image_id INT NOT NULL,
- tag_id INT NOT NULL,
---
- PRIMARY KEY (image_id, tag_id)
-);
-
-CREATE TABLE ansel_images_geolocation (
- image_id INT NOT NULL,
- image_latitude VARCHAR(32),
- image_longitude VARCHAR(32),
- image_location VARCHAR(255),
---
- PRIMARY KEY (image_id)
-);
-
-CREATE TABLE ansel_datatree_transition (
- datatree_id INT NOT NULL,
- image_id INT NOT NULL,
- vfsname VARCHAR(255) NOT NULL
-);
+++ /dev/null
-#!/usr/bin/env php
-<?php
-/**
- * Correct geolocation data
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- */
-
-require_once dirname(__FILE__) . '/../../lib/Application.php';
-Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-
-// First update the tables
-$alter = array("ALTER TABLE ansel_images ADD COLUMN image_latitude VARCHAR(32) NOT NULL DEFAULT ''",
- "ALTER TABLE ansel_images ADD COLUMN image_longitude VARCHAR(32) NOT NULL DEFAULT ''",
- "ALTER TABLE ansel_images ADD COLUMN image_location VARCHAR(255) NOT NULL DEFAULT ''",
- "ALTER TABLE ansel_images ADD COLUMN image_geotag_date INT NOT NULL DEFAULT 0");
-
-foreach ($alter as $sql) {
- $cli->message(sprintf("Executing %s", $sql));
- $ansel_db->exec($sql);
-}
-
-$sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
-$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
-$sql = $ansel_db->prepare('UPDATE ansel_images SET image_latitude = ?, image_longitude = ? WHERE image_id = ?');
-foreach ($results as $image) {
- // Clean up from a bug in Exifer
- if (strlen(trim($image['image_latitude'])) <= 1 || strlen(trim($image['image_longitude'])) <= 1) {
- $cli->message(sprintf("Erroneous geoloction data for Image %d deleted", $image['image_id']), 'cli.message');
- $ansel_db->query('DELETE FROM ansel_images_geolocation WHERE image_id = ' . $image['image_id']);
- } else {
- $image['image_latitude'] = (strpos($image['image_latitude'], 'S') !== false ? '-' : '') . $image['image_latitude'];
- $image['image_latitude'] = str_replace(array('N', 'S'), array('', ''), $image['image_latitude']);
- $image['image_longitude'] = (strpos($image['image_longitude'], 'W') !== false ? '-' : '') . $image['image_longitude'];
- $image['image_longitude'] = str_replace(array('E', 'W'), array('', ''), $image['image_longitude']);
- $cli->message(sprintf("Image %d updated. %s - %s", $image['image_id'], $image['image_latitude'], $image['image_longitude']), 'cli.message');
- $sql->execute(array($image['image_latitude'], $image['image_longitude'], $image['image_id']));
- }
-}
-
-$cli->message('Done.', 'cli.success');
+++ /dev/null
-CREATE TABLE ansel_faces (
- face_id INT NOT NULL,
- image_id INT NOT NULL,
- gallery_id INT NOT NULL,
- face_name VARCHAR(255) NOT NULL,
- face_x1 INT NOT NULL,
- face_y1 INT NOT NULL,
- face_x2 INT NOT NULL,
- face_y2 INT NOT NULL,
- face_signature BLOB,
---
- PRIMARY KEY (face_id)
-);
-
-CREATE TABLE ansel_faces_index (
- face_id INT NOT NULL,
- index_position INT NOT NULL,
- index_part BLOB
-);
-CREATE INDEX ansel_faces_index_face_id_idx ON ansel_faces_index (face_id);
-CREATE INDEX ansel_faces_index_index_part_idx ON ansel_faces_index (index_part (30));
-CREATE INDEX ansel_faces_index_index_position_idx ON ansel_faces_index (index_position);
-
-ALTER TABLE ansel_shares ADD COLUMN attribute_faces INT NOT NULL;
-ALTER TABLE ansel_images ADD COLUMN image_faces INT NOT NULL;
\ No newline at end of file
+++ /dev/null
-ALTER TABLE ansel_shares CHANGE share_owner share_owner VARCHAR(255);
-ALTER TABLE ansel_shares CHANGE attribute_style attribute_style VARCHAR(255);
-ALTER TABLE ansel_shares_users CHANGE user_uid user_uid VARCHAR(255);
-ALTER TABLE ansel_faces CHANGE face_name face_name VARCHAR(255) NOT NULL;
\ No newline at end of file
+++ /dev/null
-ALTER TABLE ansel_images ADD COLUMN image_original_date INT NOT NULL;
-ALTER TABLE ansel_images CHANGE COLUMN image_uploaded image_uploaded_date INT NOT NULL;
-
-CREATE INDEX ansel_images_original_idx ON ansel_images (image_original_date);
-ALTER TABLE ansel_images DROP index ansel_images_uploaded_idx;
-CREATE INDEX ansel_images_uploaded_date_idx ON ansel_images (image_uploaded_date);
-
-ALTER TABLE ansel_shares ADD COLUMN attribute_view_mode INT NOT NULL;
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/env php
-<?php
-/**
-* Bare bones script to populate the ansel_images.image_original_date field with
-* either the exif DateTimeOriginal field, or the
-* ansel_images.image_uploaded_date value if the exif field is not present.
-*
-* See the enclosed file COPYING for license information (GPL). If you
-* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
-*
-* @author Michael J. Rubinsky <mrubinsk@horde.org>
-*/
-
-require_once dirname(__FILE__) . '/../../lib/Application.php';
-Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-
-$sql = 'SELECT image_id, image_original_date, image_uploaded_date FROM ansel_images';
-$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
-foreach ($results as $image) {
- $sql = "SELECT attr_value FROM ansel_image_attributes WHERE attr_name='DateTimeOriginal' AND image_id = " . (int)$image['image_id'];
- $datetime = $ansel_db->queryOne($sql);
- if (!$datetime) {
- $datetime = $image['image_uploaded_date'];
- }
- $sql = 'UPDATE ansel_images SET image_original_date = ' . (int)$datetime . ' WHERE image_id = ' . (int)$image['image_id'];
- $result = $ansel_db->exec($sql);
- if ($result instanceof PEAR_Error) {
- $cli->fatal($result->getMessage());
- }
- $cli->message(sprintf("Image %d updated.", $image['image_id']), 'cli.message');
-}
-$cli->message('Done.', 'cli.success');
+++ /dev/null
-ALTER TABLE ansel_shares_groups CHANGE group_uid group_uid VARCHAR(255);
-
+++ /dev/null
-CREATE TABLE ansel_images_geolocation (
- image_id INT NOT NULL,
- image_latitude varchar(32),
- image_longitude varchar(32),
-
- PRIMARY KEY (image_id)
-);
+++ /dev/null
-ALTER TABLE ansel_shares CHANGE attribute_view_mode attribute_view_mode VARCHAR(255) DEFAULT 'Normal' NOT NULL;
-
-UPDATE ansel_shares SET attribute_view_mode = 'Normal' WHERE attribute_view_mode = '0';
-UPDATE ansel_shares SET attribute_view_mode = 'Date' WHERE attribute_view_mode = '1';
-
+++ /dev/null
-ALTER TABLE ansel_shares ALTER attribute_view_mode TYPE VARCHAR(255);
-ALTER TABLE ansel_shares ALTER attribute_view_mode SET DEFAULT 'Normal';
-UPDATE ansel_shares SET attribute_view_mode = 'Normal' WHERE attribute_view_mode = '0';
-UPDATE ansel_shares SET attribute_view_mode = 'Date' WHERE attribute_view_mode = '1';
-ALTER TABLE ansel_shares ALTER attribute_view_mode SET NOT NULL;
+++ /dev/null
-#!/usr/bin/env php
-<?php
-/**
- * Correct geolocation data
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- */
-
-require_once dirname(__FILE__) . '/../../Application.php';
-Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-
-$sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
-$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
-$sql = $ansel_db->prepare('UPDATE ansel_images_geolocation SET image_latitude = ?, image_longitude = ? WHERE image_id = ?');
-foreach ($results as $image) {
- // Clean up from a bug in Exifer
- if (strlen(trim($image['image_latitude']) <= 1) || strlen(trim($image['image_longitude']) <= 1)) {
- $cli->message(sprintf("Erroneous geoloction data for Image %d deleted", $image['image_id']), 'cli.message');
- $ansel_db->query('DELETE FROM ansel_images_geolocation WHERE image_id = ' . $image['image_id']);
- } else {
- $image['image_latitude'] = (strpos($image['image_latitude'], 'S') !== false ? '-' : '') . $image['image_latitude'];
- $image['image_latitude'] = str_replace(array('N', 'S'), array('', ''), $image['image_latitude']);
- $image['image_longitude'] = (strpos($image['image_longitude'], 'W') !== false ? '-' : '') . $image['image_longitude'];
- $image['image_longitude'] = str_replace(array('E', 'W'), array('', ''), $image['image_longitude']);
- $cli->message(sprintf("Image %d updated. %s - %s", $image['image_id'], $image['image_latitude'], $image['image_longitude']), 'cli.message');
- $sql->execute(array($image['image_latitude'], $image['image_longitude'], $image['image_id']));
- }
-}
-
-// Add the location column.
-$sql = 'ALTER TABLE ansel_images_geolocation ADD COLUMN image_location VARCHAR(255)';
-$ansel_db->exec($sql);
-$cli->message('Done.', 'cli.success');
+++ /dev/null
-ALTER TABLE ansel_images ADD COLUMN image_latitude VARCHAR(32) DEFAULT '' NOT NULL;
-ALTER TABLE ansel_images ADD COLUMN image_longitude VARCHAR(32) DEFAULT '' NOT NULL;
-ALTER TABLE ansel_images ADD COLUMN image_location VARCHAR(255) DEFAULT '' NOT NULL;
+++ /dev/null
-#!/usr/bin/env php
-<?php
-/**
- * Correct geolocation data
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- */
-
-require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('ansel', array('authentication' => 'none', 'cli' => true));
-
-$sql = 'SELECT image_id, image_latitude, image_longitude FROM ansel_images_geolocation;';
-$results = $ansel_db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC);
-$sql = $ansel_db->prepare('UPDATE ansel_images SET image_latitude = ?, image_longitude = ? WHERE image_id = ?');
-foreach ($results as $image) {
- $cli->message(sprintf("Image %d updated. %s - %s", $image['image_id'], $image['image_latitude'], $image['image_longitude']), 'cli.message');
- $sql->execute(array($image['image_latitude'], $image['image_longitude'], $image['image_id']));
-}
-
-$cli->message('Done.', 'cli.success');
+++ /dev/null
-ALTER TABLE ansel_images ADD COLUMN image_geotag_date INT;
+++ /dev/null
-ALTER TABLE ansel_images CHANGE image_faces image_faces INT DEFAULT 0 NOT NULL;