An PHP based Image Database
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
GRMrGecko c94bdc878f Fixed some syntax. Fixed upload to encode html and changed plugin loop index variable to $pluginIndex so it's less likely to be used by a plugin. Probably should be using foreach or whatever it is, but I am stubborn. Added to the logout a time change to invalidate the login session. Fixed issue with pus state back to filter/index whenever you click the x button or background. Fixed user creation to use the correct password hashing system. 11 years ago
code Fixed some syntax. Fixed upload to encode html and changed plugin loop index variable to $pluginIndex so it's less likely to be used by a plugin. Probably should be using foreach or whatever it is, but I am stubborn. Added to the logout a time change to invalidate the login session. Fixed issue with pus state back to filter/index whenever you click the x button or background. Fixed user creation to use the correct password hashing system. 11 years ago
css Image Database Start 11 years ago
data Image Database Start 11 years ago
databases Image Database Start 11 years ago
external_data_plugins Image Database Start 11 years ago
img Image Database Start 11 years ago
js Image Database Start 11 years ago
load Image Database Start 11 years ago
thumbs Image Database Start 11 years ago
.htaccess Image Database Start 11 years ago
License.txt Image Database Start 11 years ago
dbSQLITE.php Image Database Start 11 years ago
footer.php Image Database Start 11 years ago
header.php Fixed some syntax. Fixed upload to encode html and changed plugin loop index variable to $pluginIndex so it's less likely to be used by a plugin. Probably should be using foreach or whatever it is, but I am stubborn. Added to the logout a time change to invalidate the login session. Fixed issue with pus state back to filter/index whenever you click the x button or background. Fixed user creation to use the correct password hashing system. 11 years ago
index.php Changed the way you can change the title of the image database form "Image Database" to anything else. Changed the way tags are handled in editing mode. Added delete button to Tagless Images mode. Added support for browser state which makes it easy to share the state you are in with others by copying the current URL shown in the browser. 11 years ago
ocr.cpp Image Database Start 11 years ago
ocr.sh Image Database Start 11 years ago
readme.md Removed unnecessary unlink from uploader and changed date for the uploads to be based on file time. This allows you to copy files to the server preserving the time it was made and go to /upload/complete to have them processed. Fixed me being lazy so that users can enter a quotation mark without having issues of the HTML code being outputted wrong. Fixed the search field so that it also corrects the HTML output rather than outputting raw data. Added the ability to search by date. Enter a date or a "to: from:" query and it will search the database by that date range. 11 years ago

readme.md

#Requirements 1: pdo sqlite

2: gd

3: Due to my coding style, you must allow short tags ("<?") in php.

4: Installation of ImageMagick. You can test this by typing "convert" in terminal. If needed, you can change configuration in index.php for the bin path.

#Installation 1: Copy all files to your server.

2: Change permissions to folders databases, load, data, and thumbs so that php can write to them. If you do not know the correct permissions, 777 will work but is inscure on shared servers.

3: Visit the database on your server and the setup process will commence.

4: Once you have finished the setup process. You may delete the setup file in the code folder if you do not want to allow anyone to setup a new database if for some reason the file gets currupted.

#Setting up your server ##Nginx Here is the configuration you need to add to your nginx server.

location ~* /(databases|load|code|external_data_plugins) {
	rewrite ^ /index.php?$args;
}
location ~* /(data|thumbs)/.*(?<\!\.gif|\.png|\.jpg|\.jpeg|\.tif|\.tiff)$ {
	rewrite ^ /index.php?$args;
}
location / {
	try_files $uri $uri/ /index.php?$args;
}

It is best to placet the ones with "rewrite" above your php include.

You can test by visiting /code/index.php to see if it loads the index file or if it shows a 404 error.

##Apache For Apache, i've already included the .htaccess files needed. Just make sure your server is configured to allow htaccess and mod_rewrite. Best test by visiting /code/index.php.

#Getting OCR to work. I've included code to OCR images for text. It's not perfect, but it provides great power.

In-order to use it, you must first install OpenCV and Tesseract-OCR. Then you should just be able to run ./ocr.sh in terminal with the image database directory as your current working directory. Only tested on OS X.

#Writing an External Data Plugin External Data plugins allows you to write plugins which grabs data from another site about an image and put it into the metadata to make search better. For an example, if there is an image tag site which contains your image and good tags, you could write your plugin to grab the tags and store them so when you search for say green, your image will popup as the tag green was on that image via the site.

Writing a plugin is simple. Make a new file in the folder external_data_plugins and then put your code inside of it to grab the data and fill the database.

<?
$ch = curl_init();
curl_setopt_array($ch, array(
	CURLOPT_URL => "http://mrgeckosmedia.com/some-api",
	CURLOPT_POSTFIELDS => array(
		"md5" => $hash
	),
	CURLOPT_RETURNTRANSFER => true
));
$received = json_decode(curl_exec($ch), true);
curl_close($ch);
if (isset($received['result']['tags'])) {
	if (!empty($external_data))
		$external_data .= " ";
	//Append to the "$external_data" variable with the description to provide rich content.
	$external_data .= $received['result']['description'];
	
	//Prefill Tags in database.
	$dtags = explode(" ", $received['result']['tags']);
	for ($i=0; $i<count($dtags); $i++) {
		if (!in_array($dtags[$i], $tags))
			array_push($tags, $dtags[$i]);
	}
}
?>

You have access to many variables about the file being processed including it's name and extension. Just look at code/upload.php to see what is available.

#Known Problems There isn't any error reporting in the API and there isn't anyway for the user to know that such an error such as network issues or database issues occured.

There isn't a way for users to to sign up. If I were to implement one... The admin would be able to choose rather to allow signups or not.