Skip to content

Commit

Permalink
Merge pull request #444 from electerious/develop
Browse files Browse the repository at this point in the history
Lychee 3.0.9
  • Loading branch information
electerious committed Jan 10, 2016
2 parents b60f9ed + 7a7ae24 commit c0c924f
Show file tree
Hide file tree
Showing 23 changed files with 205 additions and 225 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/**/* binary
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Tobias Reich (http://electerious.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
21 changes: 2 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,12 @@ Here's a list of all available Plugins and Extensions:
| lychee-watermark | Adds a second watermarked photo when uploading images | [More »](https://github.com/electerious/lychee-watermark) |
| lychee-rss | Creates a RSS-Feed out of your photos | [More »](https://github.com/cternes/Lychee-RSS) |
| lychee-FlashAir | Import from a Toshiba FlashAir WiFi SD card | [More »](https://github.com/mhp/Lychee-FlashAir) |
| lychee-webroot | Controls photos accessibility and keeps Lychee files hidden | [More »](https://github.com/Bramas/lychee-webroot) |

## Troubleshooting

Take a look at the [FAQ](docs/FAQ.md) if you have problems. Discovered a bug? Please create an issue here on GitHub!

## Developer
| Version | Name |
|:-----------|:------------|
| 1.2, 1.3, 2.x, 3.x | [Tobias Reich](http://electerious.com)|
| 1.0, 1.1 | [Tobias Reich](http://electerious.com)<br>[Philipp Maurer](http://phinal.net) |

## Donate

I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated.

## License

(MIT License)

Copyright (C) 2015 [Tobias Reich](http://electerious.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated.
2 changes: 1 addition & 1 deletion dist/main.css

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/main.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/view.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## v3.0.9

Released January 10, 2016

- `Improved` Disabled dragging for thumbnails
- `Improved` Avoided unnecessary devicePixelRatio checks by using srcset for all thumbnails
- `Improved` Avoided devicePixelRatio check by using srcset for the imageview image
- `Improved` Don't show log and system information when logged out (Thanks @Bramas, #421)
- `Fixed` Swipe-gestures on mobile devices

## v3.0.8

Released December 20, 2015
Expand Down
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can also use the [direct download](https://github.com/electerious/Lychee/arc

### 3. Permissions

Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are reqiured.
Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are required.

chmod -R 777 uploads/ data/

Expand Down
13 changes: 9 additions & 4 deletions php/modules/Album.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,20 @@ public static function prepareData($data) {
$album['title'] = $data['title'];
$album['public'] = $data['public'];

# Additional attributes
# Only part of $album when available
if (isset($data['description'])) $album['description'] = $data['description'];
if (isset($data['visible'])) $album['visible'] = $data['visible'];
if (isset($data['downloadable'])) $album['downloadable'] = $data['downloadable'];

# Parse date
$album['sysdate'] = date('F Y', $data['sysstamp']);

# Parse password
$album['password'] = ($data['password']=='' ? '0' : '1');

# Set placeholder for thumbs
$album['thumbs'] = array();
# Parse thumbs or set default value
$album['thumbs'] = (isset($data['thumbs']) ? explode(',', $data['thumbs']) : array());

return $album;

Expand Down Expand Up @@ -112,8 +118,7 @@ public function get() {
default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
$albums = $this->database->query($query);
$return = $albums->fetch_assoc();
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
$return['password'] = ($return['password']=='' ? '0' : '1');
$return = Album::prepareData($return);
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
break;

Expand Down
58 changes: 36 additions & 22 deletions plugins/check/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,41 @@
echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL);
echo('------------------' . PHP_EOL);

# Load json
$json = file_get_contents(LYCHEE_SRC . 'package.json');
$json = json_decode($json, true);

# About imagick
$imagick = extension_loaded('imagick');
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
else $imagick = '-';
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
else $imagickVersion = $imagickVersion['versionNumber'];

# Output system information
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
echo('DB Version: ' . $settings['version'] . PHP_EOL);
echo('System: ' . PHP_OS . PHP_EOL);
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
echo('Imagick: ' . $imagick . PHP_EOL);
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
# Ensure that user is logged in
session_start();

if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {

# Load json
$json = file_get_contents(LYCHEE_SRC . 'package.json');
$json = json_decode($json, true);

# About imagick
$imagick = extension_loaded('imagick');
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
else $imagick = '-';
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
else $imagickVersion = $imagickVersion['versionNumber'];

# Output system information
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
echo('DB Version: ' . $settings['version'] . PHP_EOL);
echo('System: ' . PHP_OS . PHP_EOL);
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
echo('Imagick: ' . $imagick . PHP_EOL);
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);

} else {

# Don't go further if the user is not logged in
echo('You have to be logged in to see more information.');
exit();

}

?>
42 changes: 30 additions & 12 deletions plugins/displaylog/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,45 @@
exit();
}

# Result
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
$result = $database->query($query);
# Load settings
$settings = new Settings($database);
$settings = $settings->get();

# Output
if ($result->num_rows===0) {
# Ensure that user is logged in
session_start();

echo('Everything looks fine, Lychee has not reported any problems!' . PHP_EOL . PHP_EOL);
if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {

} else {
# Result
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
$result = $database->query($query);

# Output
if ($result->num_rows===0) {

echo('Everything looks fine, Lychee has not reported any problems!');

} else {

while($row = $result->fetch_row()) {

while($row = $result->fetch_row()) {
# Encode result before printing
$row = array_map('htmlentities', $row);

# Encode result before printing
$row = array_map("htmlentities", $row);
# Format: time TZ - type - function(line) - text
printf ("%s - %s - %s (%s) \t- %s\n", $row[0], $row[1], $row[2], $row[3], $row[4]);

# Format: time TZ - type - function(line) - text
printf ("%s %s - %s - %s (%s) \t- %s\n", $row[0], date_default_timezone_get(), $row[1], $row[2], $row[3], $row[4]);
}

}

} else {

# Don't go further if the user is not logged in
echo('You have to be logged in to see the log.');
exit();

}

?>
10 changes: 5 additions & 5 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Lychee",
"version": "3.0.8",
"version": "3.0.9",
"description": "Self-hosted photo-management done right.",
"authors": "Tobias Reich <[email protected]>",
"license": "MIT",
Expand All @@ -11,15 +11,15 @@
},
"devDependencies": {
"babel-preset-es2015": "^6.3.13",
"basiccontext": "^3.5.0",
"basicmodal": "^3.3.0",
"basiccontext": "^3.5.1",
"basicmodal": "^3.3.2",
"gulp": "^3.9.0",
"gulp-autoprefixer": "3.1.0",
"gulp-babel": "^6.1.1",
"gulp-concat": "^2.6.0",
"gulp-inject": "^3.0.0",
"gulp-load-plugins": "^1.1.0",
"gulp-minify-css": "^1.2.2",
"gulp-load-plugins": "^1.2.0",
"gulp-minify-css": "^1.2.3",
"gulp-rimraf": "^0.2.0",
"gulp-sass": "^2.1.1",
"gulp-uglify": "^1.5.1",
Expand Down
32 changes: 13 additions & 19 deletions src/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ build.album = function(data) {

let html = ''

let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbs[0])
let { path: retinaThumbUrl, isPhoto } = lychee.retinize(data.thumbs[0])

html += lychee.html`
<div class='album' data-id='$${ data.id }'>
<img src='$${ data.thumbs[2] }' width='200' height='200' alt='thumb' data-overlay='false'>
<img src='$${ data.thumbs[1] }' width='200' height='200' alt='thumb' data-overlay='false'>
<img src='$${ thumbPath }' width='200' height='200' alt='thumb' data-overlay='$${ thumbRetina }'>
<img src='$${ data.thumbs[2] }' width='200' height='200' alt='Photo thumbnail' data-overlay='false' draggable='false'>
<img src='$${ data.thumbs[1] }' width='200' height='200' alt='Photo thumbnail' data-overlay='false' draggable='false'>
<img src='$${ data.thumbs[0] }' srcset='$${ retinaThumbUrl } 1.5x' width='200' height='200' alt='Photo thumbnail' data-overlay='$${ isPhoto }' draggable='false'>
<div class='overlay'>
<h1 title='$${ data.title }'>$${ data.title }</h1>
<a>$${ data.sysdate }</a>
Expand Down Expand Up @@ -82,11 +82,11 @@ build.photo = function(data) {

let html = ''

let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbUrl)
let { path: retinaThumbUrl } = lychee.retinize(data.thumbUrl)

html += lychee.html`
<div class='photo' data-album-id='$${ data.album }' data-id='$${ data.id }'>
<img src='$${ thumbPath }' width='200' height='200' alt='thumb'>
<img src='$${ data.thumbUrl }' srcset='$${ retinaThumbUrl } 1.5x' width='200' height='200' alt='Photo thumbnail' draggable='false'>
<div class='overlay'>
<h1 title='$${ data.title }'>$${ data.title }</h1>
`
Expand All @@ -113,24 +113,18 @@ build.photo = function(data) {

}

build.imageview = function(data, size, visibleControls) {
build.imageview = function(data, visibleControls) {

let html = ''

if (size==='big') {
let html = '',
hasMedium = data.medium!==''

if (visibleControls===true) html += lychee.html`<div id='image' style='background-image: url($${ data.url })'></div>`
else html += lychee.html`<div id='image' style='background-image: url($${ data.url });' class='full'></div>`
if (hasMedium===false) {

} else if (size==='medium') {
html += lychee.html`<div id='image' class='$${ visibleControls===true ? '' : 'full' }'><div><img src='$${ data.url }' draggable='false'></div></div>`

if (visibleControls===true) html += lychee.html`<div id='image' style='background-image: url($${ data.medium })'></div>`
else html += lychee.html`<div id='image' style='background-image: url($${ data.medium });' class='full'></div>`

} else if (size==='small') {
} else {

if (visibleControls===true) html += lychee.html`<div id='image' class='small' style='background-image: url($${ data.url }); width: $${ data.width }px; height: $${ data.height }px; margin-top: -$${ parseInt(data.height/2-20) }px; margin-left: -$${ data.width/2 }px;'></div>`
else html += lychee.html`<div id='image' class='small' style='background-image: url($${ data.url }); width: $${ data.width }px; height: $${ data.height }px; margin-top: -$${ parseInt(data.height/2) }px; margin-left: -$${ data.width/2 }px;'></div>`
html += lychee.html`<div id='image' class='$${ visibleControls===true ? '' : 'full' }'><div><img src='$${ data.url }' srcset='$${ data.medium } 1920w, $${ data.url } $${ data.width }w' draggable='false'></div></div>`

}

Expand Down
12 changes: 0 additions & 12 deletions src/scripts/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,11 @@ header.bind = function() {

header.show = function() {

let newMargin = (-1 * ($('#imageview #image').height()/2) + 20)

clearTimeout($(window).data('timeout'))

lychee.imageview.removeClass('full')
header.dom().removeClass('header--hidden')

// Adjust position or size of photo
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin)
else $('#imageview #image').removeClass('full')

return true

}
Expand All @@ -90,15 +84,9 @@ header.hide = function(e, delay = 500) {

$(window).data('timeout', setTimeout(function() {

let newMargin = (-1 * ($('#imageview #image').height()/2))

lychee.imageview.addClass('full')
header.dom().addClass('header--hidden')

// Adjust position or size of photo
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin)
else $('#imageview #image').addClass('full')

}, delay))

return true
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ $(document).ready(function() {
$(document)

// Fullscreen on mobile
.on('touchend', '#image', function(e) {
.on('touchend', '#imageview #image', function(e) {
if (swipe.obj==null || (swipe.offset>=-5&&swipe.offset<=5)) {
if (visible.header()) header.hide(e, 0)
else header.show()
}
})

// Swipe on mobile
.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($('#image')) })
.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($('#imageview #image')) })
.swipe().on('swipeMove', function(e) { if (visible.photo()) swipe.move(e.swipe) })
.swipe().on('swipeEnd', function(e) { if (visible.photo()) swipe.stop(e.swipe, photo.previous, photo.next) })

Expand Down
Loading

0 comments on commit c0c924f

Please sign in to comment.