Image and cultural properties browser
erDiagram
categories {
int(2) id PK
int(2) priority
varchar(256) category
varchar(256) subcategory
varchar(1024) comment
}
filters {
int(7) id PK
int(7) fk_properties_id FK
int(2) fk_categories_id FK
}
properties {
int(7) id PK
varchar(32) image
varchar(255) street_address
varchar(255) photographer
varhcar(255) date
}
attributes {
int(9) id PK
int(7) fk_properties_id FK
varchar(256) name
varchar(1024) value
}
categories ||--|{ filters : ""
properties ||--|{ filters : ""
properties ||--|{ attributes : ""
categoriestable to help build navigation dropdown of categories and sub-categoriesfilterstable maps categories and sub-categories to each accession (image)propertiestable defines each of the 20,000 randomly generated accessions (images)- Note:
dateis not defined using the MySQLdatetype as the reference for this project contained arbitrary dates, e.g., "Temporal 1900-1909"
- Note:
attributestable stores additional, arbitrary metadata for each accession
- View comments at bottom of: Database.php
- Modify
my.cnfto enforcesql_mode="STRICT_ALL_TABLES"for primary/foriegn key InnoDB constraints. - CREATE DATABASE
browser
- CREATE USER and GRANTS
browser_www
- CREATE TABLES
categoriespropertiesfiltersattributes
- CREATE INDEX
categoriesfiltersattributes
- Copy credentials.php-template to
credentials.php- Configure values; database user must have a GRANT to perform INSERT.
- Run populate_database.php
- e.g.,
20000accessions - Only run this script once. If you need to re-run then first drop the tables and recreate.
- This is necessary as the script assumes a certain order/offset from the auto increment primary keys.
- e.g.,
Example is from Ubuntu /etc/apache2/sites-enabled/ configuration files
- Per LightVC (https://github.com/awbush/lightvc) setup you must specify both the
DocumentRootandDirectoryaswebroot- Do not specify these variables as the top-level directory, e.g.,
/data/www/browser
- Do not specify these variables as the top-level directory, e.g.,
- Define
<MY FQDN>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /data/www/browser/webroot
ServerName browser.<MY FQDN>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /data/www/browser/webroot>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>- Simulated content delivery network (see Application documentation below)
- Define
<MY FQDN>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /data/www/cdn
ServerName cdn.<MY FQDN>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /data/www/cdn>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>- Simulate CDN by deploying "Dynamic Dummy Image Generator" (http://dummyimage.com/) to VHOST.
- The
index.phpis not required;code.phpis required and referenced by.htaccess - GD required, e.g., on Ubuntu:
apt-get install php5-gd
- The
- Line 110 of code.php may need to have the explicit path to the font (on Ubuntu):
$font = "/data/www/cdn/mplus-1c-medium.ttf";
- Copy config.php-template to
config.php- Configure values
- User should be
browser_wwwwith only a GRANT to SELECT. CDN_URLis the VHOST defined for th content delivery network (above).