diff --git a/css/style.css b/css/style.css
index 10d9028..7df9eab 100755
--- a/css/style.css
+++ b/css/style.css
@@ -349,6 +349,11 @@ header {
#tools_albums, #tools_album, #tools_photo {
display: none;
}
+
+ /* Button Custom ------------------------------------------------*/
+ header .button.icon-refresh {
+ padding: 7px 10px 4px 10px;
+ }
/* Button Divider ------------------------------------------------*/
header .button_divider {
@@ -854,6 +859,13 @@ header {
.sign_in input.error:focus {
box-shadow: 0px 1px 0px #777, inset 0px 0px 3px #333, 0px 0px 5px #cc0007;
}
+ .message #version {
+ display: inline-block;
+ margin-top: 23px;
+ margin-left: 19px;
+ color: #888;
+ text-shadow: 0px -1px 0px #111;
+ }
/* Sign in ------------------------------------------------*/
.copylink {
@@ -891,7 +903,7 @@ header {
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: contain;
- -webkit-transition: top .3s, bottom .3s;
+ -webkit-transition: top .3s, bottom .3s, margin-top .3s;
-webkit-animation-name: zoomIn;
-webkit-animation-duration: .3s;
@@ -906,6 +918,12 @@ header {
animation-duration: .3s;
animation-fill-mode: forwards;
}
+#image_view #image.small {
+ top: 50%;
+ right: auto;
+ bottom: auto;
+ left: 50%;
+}
/* Previous/Next Buttons ------------------------------------------------*/
#image_view a {
diff --git a/img/apple-touch-icon.png b/img/apple-touch-icon.png
new file mode 100644
index 0000000..bd3b738
Binary files /dev/null and b/img/apple-touch-icon.png differ
diff --git a/index.html b/index.html
old mode 100644
new mode 100755
index d3f5362..6a52ba9
--- a/index.html
+++ b/index.html
@@ -14,6 +14,7 @@
+
@@ -31,6 +32,7 @@
diff --git a/js/build.js b/js/build.js
index 9e6beae..529cf20 100644
--- a/js/build.js
+++ b/js/build.js
@@ -140,6 +140,7 @@ function buildSignInModal() {
modal += "";
modal += "";
modal += "";
+ modal += "Version " + version + "
";
modal += "Sign in";
modal += "";
modal += "";
diff --git a/js/functions.js b/js/functions.js
index c6aec31..7cf0f4a 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -68,21 +68,39 @@ function setURL(website_url) {
}
function getURL() {
+
closeContextMenu();
hash = document.location.hash.replace("#", "");
- if (hash.indexOf("a")!=-1) {
- if (hash.indexOf("p")!=-1) {
- hash = hash.split("p");
- content.hide();
- showImageview(hash[1]);
- if (content.html()=="") loadPhotos(hash[0].replace("a", ""), true);
- } else {
- if (visibleImageview()) hideImageview();
- else loadPhotos(hash.replace("a", ""), false);
- }
+
+ albumID = "";
+ photoID = "";
+
+ if (hash.indexOf("a")!=-1) albumID = hash.split("p")[0].replace("a", "");
+ if (hash.indexOf("p")!=-1) photoID = hash.split("p")[1];
+
+ if (hash=="upload") {
+
+ loadAlbums();
+ $("body").append(buildAddModal);
+
+ } else if (albumID&&photoID) {
+
+ content.hide();
+ showImageview(photoID);
+ if (content.html()=="") loadPhotos(albumID, true);
+
+ } else if (albumID) {
+
+ if (!visibleControls()) showControls();
+ if (visibleImageview()) hideImageview();
+ else loadPhotos(albumID, false);
+
} else {
+
loadAlbums();
+
}
+
}
/*
@@ -190,12 +208,18 @@ function showControls() {
image_view.css("background-color", "rgba(30,30,30,.99)");
loading.css("opacity", 1);
header.css("margin-Top", "0px");
- $("#image_view #image").css({
- top: 70,
- right: 30,
- bottom: 30,
- left: 30
- });
+ if ($("#image_view #image.small").length>0) {
+ $("#image_view #image").css({
+ marginTop: -1*($("#image_view #image").height()/2)+20
+ });
+ } else {
+ $("#image_view #image").css({
+ top: 70,
+ right: 30,
+ bottom: 30,
+ left: 30
+ });
+ }
}
}
function hideControls() {
@@ -207,12 +231,18 @@ function hideControls() {
image_view.css("background-color", "#111");
loading.css("opacity", 0);
header.css("margin-Top", "-45px");
- $("#image_view #image").css({
- top: 0,
- right: 0,
- bottom: 0,
- left: 0
- });
+ if ($("#image_view #image.small").length>0) {
+ $("#image_view #image").css({
+ marginTop: -1*($("#image_view #image").height()/2)
+ });
+ } else {
+ $("#image_view #image").css({
+ top: 0,
+ right: 0,
+ bottom: 0,
+ left: 0
+ });
+ }
}, 500));
}
}
@@ -354,6 +384,21 @@ function visibleInfobox() {
else return true;
}
+function isPhotoSmall(photo) {
+
+ size = [
+ ["width", false],
+ ["height", false]
+ ];
+
+ if (photo.width<$(window).width()-60) size["width"] = true;
+ if (photo.height<$(window).height()-100) size["height"] = true;
+
+ if (size["width"]&&size["height"]) return true;
+ else return false;
+
+}
+
/*
Key Function
This function triggers events when a special key is pressed.
@@ -447,7 +492,7 @@ function renamePhoto(photoID) {
newTitle = prompt("Please enter a new title for this photo:", oldTitle);
- if (photoID!=""&&photoID!=null&&photoID!=undefined&&newTitle.length>2&&newTitle.length<31) {
+ if (photoID!=null&&photoID!=undefined&&newTitle.length<31) {
loadingFadeIn("loading");
@@ -680,8 +725,10 @@ function loadPhotoInfo(photoID) {
}
image_view.attr("data-id", photoID);
- if (visibleControls()) image_view.html("").append("");
- else image_view.html("").append("");
+ if (visibleControls()&&isPhotoSmall(data)) image_view.html("").append("");
+ else if (visibleControls()) image_view.html("").append("");
+ else if (isPhotoSmall(data)) image_view.html("").append("");
+ else image_view.html("").append("");
image_view.removeClass("fadeOut").addClass("fadeIn").show();
if (!visibleControls()) hideControls(true);
@@ -914,6 +961,18 @@ function loadNextPhoto() {
}
+function syncFolder() {
+
+ params = "function=syncFolder";
+ $.ajax({type: "POST", url: api_path, data: params, success: function(data) {
+
+ if (data==1) setURL("a0");
+ else loadingFadeIn("error");
+
+ }, error: ajaxError });
+
+}
+
function search(term) {
clearTimeout($(window).data("timeout"));
diff --git a/js/main.js b/js/main.js
index 0f3cbf9..690a421 100755
--- a/js/main.js
+++ b/js/main.js
@@ -11,7 +11,8 @@ var header = $("header"),
image_view = $("#image_view"),
loading = $("#loading"),
infobox = $("#infobox"),
- api_path = "php/api.php";
+ api_path = "php/api.php",
+ version = "1.0.1";
$(document).ready(function(){
@@ -46,6 +47,7 @@ $(document).ready(function(){
$("#button_edit").live("click", function() { renamePhoto() });
$("#button_info").live("click", function() { showInfobox() });
$("#button_archive").live("click", function() { getAlbumArchive() });
+ $("#button_sync").live("click", function() { syncFolder() });
/* Rename Album/Photo via Titlebar */
$("#title.editable").live("click", function() {
diff --git a/js/view.js b/js/view.js
index eeca97b..198cf43 100644
--- a/js/view.js
+++ b/js/view.js
@@ -13,6 +13,9 @@ var header = $("header"),
$(document).ready(function(){
+ /* Window */
+ $(window).keydown(key);
+
/* Infobox */
$("#infobox_overlay, #infobox .header a").live("click", function() { hideInfobox() });
$("#button_info").live("click", function() { showInfobox() });
@@ -27,6 +30,35 @@ $(document).ready(function(){
});
+function key(e) {
+
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code==27&&visibleInfobox()) { hideInfobox(); e.preventDefault(); }
+
+}
+
+function visibleInfobox() {
+
+ if (parseInt(infobox.css("right").replace("px", ""))<0) return false;
+ else return true;
+
+}
+
+function isPhotoSmall(photo) {
+
+ size = [
+ ["width", false],
+ ["height", false]
+ ];
+
+ if (photo.width<$(window).width()-60) size["width"] = true;
+ if (photo.height<$(window).height()-100) size["height"] = true;
+
+ if (size["width"]&&size["height"]) return true;
+ else return false;
+
+}
+
function showInfobox() {
$("body").append("");
@@ -51,7 +83,8 @@ function loadPhotoInfo(photoID) {
headerTitle.html(data.title);
image_view.attr("data-id", photoID);
- image_view.html("").append("");
+ if (isPhotoSmall(data)) image_view.html("").append("");
+ else image_view.html("").append("");
image_view.removeClass("fadeOut").addClass("fadeIn").show();
infobox.html(buildInfobox(data)).show();
diff --git a/lychee.sql b/lychee.sql
old mode 100644
new mode 100755
diff --git a/php/api.php b/php/api.php
index ef7a58e..4ee1cae 100644
--- a/php/api.php
+++ b/php/api.php
@@ -16,7 +16,6 @@ if((isset($_POST["function"])&&$_POST["function"]!="")||(isset($_GET["function"]
// Security
if(isset($_POST["albumID"])&&($_POST["albumID"]==""||$_POST["albumID"]<0)) exit("Wrong parameter type for 'albumID'!");
if(isset($_POST["photoID"])&&$_POST["photoID"]=="") exit("Wrong parameter type for 'photoID'!");
- if(isset($_POST["title"])&&$_POST["title"]=="") exit("Wrong parameter type for 'title'!");
if($_SESSION["login"]==true) {
@@ -45,11 +44,14 @@ if((isset($_POST["function"])&&$_POST["function"]!="")||(isset($_GET["function"]
if($_POST["function"]=="previousPhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo array2json(previousPhoto($_POST["photoID"], $_POST["albumID"]));
if($_POST["function"]=="nextPhoto"&&isset($_POST["photoID"])&&isset($_POST["albumID"])) echo array2json(nextPhoto($_POST["photoID"], $_POST["albumID"]));
- // Upload Function
+ // Upload Function
if($_POST["function"]=="upload"&&isset($_FILES)&&isset($_POST["albumID"])) echo upload($_FILES, $_POST["albumID"]);
- // Upload Function
- if($_POST["function"]=="search"&&isset($_POST["term"])) echo array2json(search($_POST["term"]));
+ // Search Function
+ if($_POST["function"]=="search"&&isset($_POST["term"])) echo array2json(search($_POST["term"]));
+
+ // Sync Function
+ if($_POST["function"]=="syncFolder") echo syncFolder();
// Session Functions
if($_POST["function"]=="logout") logout();
diff --git a/php/config.php b/php/config.php
index 3452c48..21128e3 100644
--- a/php/config.php
+++ b/php/config.php
@@ -4,13 +4,14 @@
* @name config.php
* @author Philipp Maurer
* @author Tobias Reich
- * @copyright 2012 by Philipp Maurer, Tobias Reich
+ * @copyright 2012 by Philipp Maurer, Tobias Reich
*/
//Database configurations
$db = "lychee"; //Database name
-$dbUser = ""; //Username of the database
-$dbPassword = ""; //Password of the Database
+$dbUser = "lychee"; //Username of the database
+$dbPassword = "lychee_passwd"; //Password of the Database
+$dbHost = "localhost"; //Host of the Database
//lychee user configuration
$user = "lychee"; //lychee username
@@ -21,4 +22,4 @@ $thumbQuality = 95; //Quality of the Thumbs (0-100). Default: 95
$bitlyUsername = ""; //Your Bit.ly Username
$bitlyApi = ""; //Your Bit.ly API Key
-?>
+?>
\ No newline at end of file
diff --git a/php/functions.php b/php/functions.php
index 02201ef..5cb8eeb 100644
--- a/php/functions.php
+++ b/php/functions.php
@@ -11,16 +11,16 @@ include("config.php");
// Database Functions
function dbConnect() {
- global $db, $dbUser, $dbPassword;
- $connect = mysql_connect("localhost", $dbUser, $dbPassword);
+ global $db, $dbUser, $dbPassword, $dbHost;
+ $connect = mysql_connect($dbHost, $dbUser, $dbPassword);
if(!$connect) {
echo "No connection: ".mysql_error();
return false;
}
$dbSelect = mysql_select_db($db);
if(!$dbSelect) {
- echo "Can not find Database!";
- return false;
+ if(createDatabase($db)){$dbSelect = mysql_select_db($db);}
+ else {echo "Can not create Database!"; return false;}
}
$query = "SELECT * FROM photos, albums;";
if(!mysql_query($query)) createTables();
@@ -34,6 +34,12 @@ function dbClose() {
}
return true;
}
+function createDatabase($db) {
+ $query = "CREATE DATABASE $db;";
+ $result = mysql_query($query);
+ if(!$result) return false;
+ return true;
+}
function createTables() {
$query = "CREATE TABLE IF NOT EXISTS `albums` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -524,7 +530,7 @@ function movePhoto($photoID, $newAlbum) {
}
function setPhotoTitle($photoID, $title) {
$title = mysql_real_escape_string(urldecode($title));
- if(strlen($title)<3||strlen($title)>30) return false;
+ if(strlen($title)>30) return false;
$query = "UPDATE photos SET title = '$title' WHERE id = '$photoID';";
$result = mysql_query($query);
if(!$result) return false;
diff --git a/readme.md b/readme.md
old mode 100644
new mode 100755
index 5fb076b..8693bc8
--- a/readme.md
+++ b/readme.md
@@ -2,7 +2,10 @@
#### A great looking and easy-to-use Photo-Management-System.
-Lychee is open-source and free to use wherever you want. Just download the source and follow the instructions to install Lychee on your server.
+![Lychee ImageView](http://lychee.electerious.com/uploads/big/13511584079432.png)
+![Lychee ImageView](http://lychee.electerious.com/uploads/big/13497110451270.png)
+
+Lychee is a free, easy to use and great looking photo-management-system you can run on your server to manage and share photos. Just download the source and follow the instructions to install Lychee wherever you want.
## Installation
@@ -20,15 +23,18 @@ To use Lychee without restrictions, we recommend to increase the values of the f
upload_max_filesize = 100M
max_file_uploads = 100
post_max_size = 100M
-#### MySQL configuration
+#### Folder permissions
+
+Change the permissions of `/lychee/uploads` to 777, including all subfolders:
+
+ chmod -R 777 /lychee/uploads
-Create a new Database and remember the name.
-
#### Lychee configuration `lychee/php/config.php`
Change the following properties with your MySQL information:
- $db = The name of the Database you want to use
$dbUser = Your MySQL username
$dbPassword = Your MySQL password
+ $db = The name of the Database you want to use
+ -> Lychee will create the Database for you
$dbUser = Your MySQL username
$dbPassword = Your MySQL password
$dbHost = Your MySQL host (in most cases you can use localhost)
Your photos are protected by a username and password you need to set: