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 : ""
categories
table to help build navigation dropdown of categories and sub-categoriesfilters
table maps categories and sub-categories to each accession (image)properties
table defines each of the 20,000 randomly generated accessions (images)- Note:
date
is not defined using the MySQLdate
type as the reference for this project contained arbitrary dates, e.g., "Temporal 1900-1909"
- Note:
attributes
table stores additional, arbitrary metadata for each accession
- View comments at bottom of: Database.php
- Modify
my.cnf
to enforcesql_mode="STRICT_ALL_TABLES"
for primary/foriegn key InnoDB constraints. - CREATE DATABASE
browser
- CREATE USER and GRANTS
browser_www
- CREATE TABLES
categories
properties
filters
attributes
- CREATE INDEX
categories
filters
attributes
- Copy credentials.php-template to
credentials.php
- Configure values; database user must have a GRANT to perform INSERT.
- Run populate_database.php
- e.g.,
20000
accessions - 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
DocumentRoot
andDirectory
aswebroot
- 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.php
is not required;code.php
is 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_www
with only a GRANT to SELECT. CDN_URL
is the VHOST defined for th content delivery network (above).