Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lychee 3.1.1 #534

Merged
merged 46 commits into from
Apr 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
45a5713
Merge pull request #5 from electerious/develop
qligier Mar 22, 2016
cf52e55
Updated deps
electerious Mar 31, 2016
1ef78f5
Added reset username and password to FAQ #500 #128
electerious Mar 31, 2016
9981f55
Fixed a floating bug when tables are to small
electerious Mar 31, 2016
9a7ed49
Removed will-change from the main image to improve the image renderin…
electerious Apr 1, 2016
65a9a44
LICENSE.md -> LICENSE
electerious Apr 8, 2016
592c759
Show share button when logged out #473
electerious Apr 8, 2016
ec69564
Code style adjustment
electerious Apr 8, 2016
ba8078f
Comment change
electerious Apr 8, 2016
134d290
Added basicContext to view scripts
electerious Apr 8, 2016
cba5a39
Don't show dropbox in public share menu #473
electerious Apr 8, 2016
8307d36
Added share menu to view.php #473
electerious Apr 8, 2016
9f8f3f7
Removed optimized event from view.php
electerious Apr 8, 2016
da92ac2
Open Facebook and Twitter sharing sheet in new window
electerious Apr 8, 2016
1365310
Rebuild
electerious Apr 8, 2016
38bbb31
Updated jQuery
electerious Apr 8, 2016
96a3524
Optimized images
electerious Apr 10, 2016
0006b06
Improved scroll and rendering performance by removing will-change
electerious Apr 10, 2016
156313f
Hide alt text on unloaded images
electerious Apr 10, 2016
42fafb0
Rebuild
electerious Apr 10, 2016
55577e1
Merge pull request #6 from electerious/develop
qligier Apr 17, 2016
00ca1e0
Modification of EXIF extraction
qligier Apr 17, 2016
69fc864
Correction of comment
qligier Apr 17, 2016
9d8f935
Import photo tags
qligier Apr 17, 2016
20e22d2
Correction of photo tag formatting
qligier Apr 17, 2016
e2509b1
Import GPS coordinates from EXIF
qligier Apr 17, 2016
ea7bfa6
Small corrections in EXIF
qligier Apr 17, 2016
7841cad
Small corrections
qligier Apr 17, 2016
0e6c9e9
Correction of function name
qligier Apr 17, 2016
8b25259
Correction of Focal data extraction
qligier Apr 17, 2016
b9a7bd1
Merge pull request #518 from qligier/pr-exif2
electerious Apr 18, 2016
9e59062
Syntax adjustments #518
electerious Apr 18, 2016
dff4800
Fixed broken URL in Update.md #516
electerious Apr 18, 2016
66bf883
Merge pull request #7 from electerious/develop
qligier Apr 18, 2016
84985f7
Fix for bad EXIF data read errors
qligier Apr 18, 2016
a8a7b15
Merge pull request #520 from qligier/pr-exif2
electerious Apr 18, 2016
aa0209a
Fix error 500 on database connect error
tribut Apr 24, 2016
3bf4790
Merge pull request #530 from tribut/connect-error
electerious Apr 24, 2016
d94960d
Made connect_error a private function #530
electerious Apr 24, 2016
cd9ce7e
Updated outdated PHP version
electerious Apr 25, 2016
97c4cb2
Updated changelog
electerious Apr 30, 2016
640b674
Updated deps
electerious Apr 30, 2016
8288672
Fixed missing function in view.php
electerious Apr 30, 2016
916ec66
Fixed separator not showing up when logged in
electerious Apr 30, 2016
8b6753a
Rebuild
electerious Apr 30, 2016
4dd2155
Updated version to 3.1.1
electerious Apr 30, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
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
100755 → 100644

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Released April 30, 2016

- `New` share button when logged out (#473)
- `New` Import of IPTC photo tags (Thanks @qligier, #514)
- `New` Added reset username and password to FAQ (#500 #128)
- `Improved` Removed will-change from the main image to improve the image rendering in Chrome (#501)
- `Improved ` scroll and rendering performance by removing will-change
- `Improved` Open Facebook and Twitter sharing sheet in new window
- `Improved` EXIF and IPTC extraction (Thanks @qligier, #518)
- `Fixed` broken URL in Update.md (#516)
- `Fixed` error 500 on database connect error (Thanks @tribut, #530)

## v3.1.0

Released March 29, 2016
Expand Down
9 changes: 6 additions & 3 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
If Lychee is not working properly, try to open `plugins/Diagnostics/index.php`. This script will display all errors it can find.

#### What do I need to run Lychee on my server?
To run Lychee, everything you need is a web-server with PHP 5.3 or later and a MySQL-Database.
To run Lychee, everything you need is a web-server with PHP 5.5 or later and a MySQL-Database.

#### I can't upload photos
If you experience problems uploading large photos, you might want to change the PHP parameters in `.htaccess` (if you are using the PHP Apache module) or in `.user.ini` (if you are using PHP >= 5.3 with CGI or FastCGI).
If you experience problems uploading large photos, you might want to change the PHP parameters in `.htaccess` (if you are using the PHP Apache module) or in `.user.ini` (if you are using PHP >= 5.5 with CGI or FastCGI).

If possible, change these settings directly in your `php.ini`. We recommend to increase the values of the following properties:

Expand Down Expand Up @@ -55,4 +55,7 @@ Yes. Lychee uses ImageMagick when available.
There's a problem with images compressed by ImageOptim. [Read more.](https://github.com/electerious/Lychee/issues/175#issuecomment-47403992)

#### How to change the title of the site?
[#455](https://github.com/electerious/Lychee/issues/455)
[#455](https://github.com/electerious/Lychee/issues/455)

#### How to reset username and password?
Simply delete the whole `lychee_settings` table from the database. Lychee will regenerate it and ask you to enter a new username and password.
2 changes: 1 addition & 1 deletion docs/Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Updating Lychee with `git` is the easiest way:

### Update manually

1. Download the [newest Version](https://github.com/electerious/Lychee/release)
1. Download the [newest Version](https://github.com/electerious/Lychee/releases)
2. Replace all existing files, excluding `uploads/` and `data/`
3. Open Lychee (and enter your database details)

Expand Down
11 changes: 10 additions & 1 deletion php/Modules/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private function __construct($host, $user, $password, $name = 'lychee', $dbTable
$connection = self::connect($host, $user, $password);

// Check if the connection was successful
if ($connection===false) Response::error($connection->connect_error);
if ($connection===false) Response::error(self::connect_error());

if (self::setCharset($connection)===false) Response::error('Could not set database charset!');

Expand Down Expand Up @@ -90,6 +90,15 @@ public static function connect($host = 'localhost', $user, $password) {

}

/**
* @return string Returns the string description of the last connect error
*/
private static function connect_error() {

return mysqli_connect_error();

}

/**
* @return boolean Returns true when successful.
*/
Expand Down
108 changes: 65 additions & 43 deletions php/Modules/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function add(array $files, $albumID = 0, $returnOnError = false) {
}

// Save to DB
$values = array(LYCHEE_TABLE_PHOTOS, $id, $info['title'], $photo_name, $info['description'], '', $info['type'], $info['width'], $info['height'], $info['size'], $info['iso'], $info['aperture'], $info['make'], $info['model'], $info['shutter'], $info['focal'], $info['takestamp'], $path_thumb, $albumID, $public, $star, $checksum, $medium);
$values = array(LYCHEE_TABLE_PHOTOS, $id, $info['title'], $photo_name, $info['description'], $info['tags'], $info['type'], $info['width'], $info['height'], $info['size'], $info['iso'], $info['aperture'], $info['make'], $info['model'], $info['shutter'], $info['focal'], $info['takestamp'], $path_thumb, $albumID, $public, $star, $checksum, $medium);
$query = Database::prepare(Database::get(), "INSERT INTO ? (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum, medium) VALUES ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?')", $values);
$result = Database::execute(Database::get(), $query, __METHOD__, __LINE__);

Expand Down Expand Up @@ -307,7 +307,7 @@ private function createThumb($url, $filename, $type, $width, $height) {
$newUrl2x = LYCHEE_UPLOADS_THUMB . $photoName[0] . '@2x.jpeg';

// Create thumbnails with Imagick
if(extension_loaded('imagick')&&Settings::get()['imagick']==='1') {
if(Settings::hasImagick()) {

// Read image
$thumb = new Imagick();
Expand Down Expand Up @@ -727,86 +727,108 @@ public function getInfo($url) {
$info = getimagesize($url, $iptcArray);

// General information
$return['type'] = $info['mime'];
$return['width'] = $info[0];
$return['height'] = $info[1];
$return['type'] = $info['mime'];
$return['width'] = $info[0];
$return['height'] = $info[1];
$return['title'] = '';
$return['description'] = '';
$return['orientation'] = '';
$return['iso'] = '';
$return['aperture'] = '';
$return['make'] = '';
$return['model'] = '';
$return['shutter'] = '';
$return['focal'] = '';
$return['takestamp'] = 0;
$return['lens'] = '';
$return['tags'] = '';
$return['position'] = '';
$return['latitude'] = '';
$return['longitude'] = '';
$return['altitude'] = '';

// Size
$size = filesize($url)/1024;
if ($size>=1024) $return['size'] = round($size/1024, 1) . ' MB';
else $return['size'] = round($size, 1) . ' KB';

// IPTC Metadata Fallback
$return['title'] = '';
$return['description'] = '';

// IPTC Metadata
// See https://www.iptc.org/std/IIM/4.2/specification/IIMV4.2.pdf for mapping
if(isset($iptcArray['APP13'])) {

$iptcInfo = iptcparse($iptcArray['APP13']);
if (is_array($iptcInfo)) {

$temp = @$iptcInfo['2#105'][0];
if (isset($temp)&&strlen($temp)>0) $return['title'] = $temp;
// Title
if (!empty($iptcInfo['2#105'][0])) $return['title'] = $iptcInfo['2#105'][0];
else if (!empty($iptcInfo['2#005'][0])) $return['title'] = $iptcInfo['2#005'][0];

$temp = @$iptcInfo['2#120'][0];
if (isset($temp)&&strlen($temp)>0) $return['description'] = $temp;
// Description
if (!empty($iptcInfo['2#120'][0])) $return['description'] = $iptcInfo['2#120'][0];

$temp = @$iptcInfo['2#005'][0];
if (isset($temp)&&strlen($temp)>0&&$return['title']==='') $return['title'] = $temp;
// Tags
if (!empty($iptcInfo['2#025'])) $return['tags'] = implode(',', $iptcInfo['2#025']);

// Position
$fields = array();
if (!empty($iptcInfo['2#090'])) $fields[] = trim($iptcInfo['2#090'][0]);
if (!empty($iptcInfo['2#092'])) $fields[] = trim($iptcInfo['2#092'][0]);
if (!empty($iptcInfo['2#095'])) $fields[] = trim($iptcInfo['2#095'][0]);
if (!empty($iptcInfo['2#101'])) $fields[] = trim($iptcInfo['2#101'][0]);

if (!empty($fields)) $return['position'] = implode(', ', $fields);

}

}

// EXIF Metadata Fallback
$return['orientation'] = '';
$return['iso'] = '';
$return['aperture'] = '';
$return['make'] = '';
$return['model'] = '';
$return['shutter'] = '';
$return['focal'] = '';
$return['takestamp'] = 0;

// Read EXIF
if ($info['mime']=='image/jpeg') $exif = @exif_read_data($url, 'EXIF', 0);
if ($info['mime']=='image/jpeg') $exif = @exif_read_data($url, 'EXIF', false, false);
else $exif = false;

// EXIF Metadata
if ($exif!==false) {

// Orientation
if (isset($exif['Orientation'])) $return['orientation'] = $exif['Orientation'];
else if (isset($exif['IFD0']['Orientation'])) $return['orientation'] = $exif['IFD0']['Orientation'];

$temp = @$exif['ISOSpeedRatings'];
if (isset($temp)) $return['iso'] = $temp;
// ISO
if (!empty($exif['ISOSpeedRatings'])) $return['iso'] = $exif['ISOSpeedRatings'];

$temp = @$exif['COMPUTED']['ApertureFNumber'];
if (isset($temp)) $return['aperture'] = $temp;
// Aperture
if (!empty($exif['COMPUTED']['ApertureFNumber'])) $return['aperture'] = $exif['COMPUTED']['ApertureFNumber'];

$temp = @$exif['Make'];
if (isset($temp)) $return['make'] = trim($temp);
// Make
if (!empty($exif['Make'])) $return['make'] = trim($exif['Make']);

$temp = @$exif['Model'];
if (isset($temp)) $return['model'] = trim($temp);
// Model
if (!empty($exif['Model'])) $return['model'] = trim($exif['Model']);

$temp = @$exif['ExposureTime'];
if (isset($temp)) $return['shutter'] = $exif['ExposureTime'] . ' s';
// Exposure
if (!empty($exif['ExposureTime'])) $return['shutter'] = $exif['ExposureTime'] . ' s';

$temp = @$exif['FocalLength'];
if (isset($temp)) {
if (strpos($temp, '/')!==FALSE) {
$temp = explode('/', $temp, 2);
// Focal Length
if (!empty($exif['FocalLength'])) {
if (strpos($exif['FocalLength'], '/')!==false) {
$temp = explode('/', $exif['FocalLength'], 2);
$temp = $temp[0] / $temp[1];
$temp = round($temp, 1);
$return['focal'] = $temp . ' mm';
} else {
$return['focal'] = $exif['FocalLength'] . ' mm';
}
$return['focal'] = $temp . ' mm';
}

$temp = @$exif['DateTimeOriginal'];
if (isset($temp)) $return['takestamp'] = strtotime($temp);
// Takestamp
if (!empty($exif['DateTimeOriginal'])) $return['takestamp'] = strtotime($exif['DateTimeOriginal']);

// Lens field from Lightroom
if (!empty($exif['UndefinedTag:0xA434'])) $return['lens'] = trim($exif['UndefinedTag:0xA434']);

// Deal with GPS coordinates
if (!empty($exif['GPSLatitude']) && !empty($exif['GPSLatitudeRef'])) $return['latitude'] = getGPSCoordinate($exif['GPSLatitude'], $exif['GPSLatitudeRef']);
if (!empty($exif['GPSLongitude']) && !empty($exif['GPSLongitudeRef'])) $return['longitude'] = getGPSCoordinate($exif['GPSLongitude'], $exif['GPSLongitudeRef']);

}

Expand Down
7 changes: 7 additions & 0 deletions php/Modules/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ public static function setSortingAlbums($type, $order) {

}

/**
* @return array Returns the Imagick setting.
*/
public static function hasImagick() {
return (bool)(extension_loaded('imagick') && self::get()['imagick'] === '1');
}

}

?>
30 changes: 30 additions & 0 deletions php/helpers/getGPSCoordinate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* Returns the normalized coordinate from EXIF array.
* @return string Normalized coordinate as float number (degrees).
*/
function getGPSCoordinate($coordinate, $ref) {

$degrees = count($coordinate) > 0 ? formattedToFloatGPS($coordinate[0]) : 0;
$minutes = count($coordinate) > 1 ? formattedToFloatGPS($coordinate[1]) : 0;
$seconds = count($coordinate) > 2 ? formattedToFloatGPS($coordinate[2]) : 0;

$flip = ($ref == 'W' || $ref == 'S') ? -1 : 1;

return $flip * ($degrees + (float)$minutes / 60 + (float)$seconds / 3600);

}

function formattedToFloatGPS($coordinate) {

$parts = explode('/', $coordinate, 2);

if (count($parts) <= 0) return 0;
if (count($parts) == 1) return $parts[0];

return (float)$parts[0] / $parts[1];

}

?>
1 change: 1 addition & 0 deletions php/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require(__DIR__ . '/helpers/fastImageCopyResampled.php');
require(__DIR__ . '/helpers/generateID.php');
require(__DIR__ . '/helpers/getExtension.php');
require(__DIR__ . '/helpers/getGPSCoordinate.php');
require(__DIR__ . '/helpers/getGraphHeader.php');
require(__DIR__ . '/helpers/getHashedString.php');
require(__DIR__ . '/helpers/hasPermissions.php');
Expand Down
1 change: 1 addition & 0 deletions src/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ paths.view = {
],
scripts: [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/basiccontext/dist/basicContext.min.js',
'../dist/_view--javascript.js'
],
svg: [
Expand Down
Binary file modified src/images/apple-touch-icon-ipad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/images/apple-touch-icon-iphone-plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/images/apple-touch-icon-iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/images/no_cover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/images/no_images.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/images/password.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading