Merge pull request #559 from electerious/develop

Lychee 3.1.2
pull/581/merge v3.1.2
Tobias Reich 8 years ago committed by GitHub
commit 475ae5748b

2
dist/main.js vendored

File diff suppressed because one or more lines are too long

@ -1,3 +1,13 @@
## v3.1.2
Released June 12, 2016
- `Improved` Added indexes to SQL fields to improve query execution time (Thanks @qligier, #533)
- `Improved` Protocol-relative URLs for open graph metadata (#546)
- `Improved` Remove metadata from medium-sized images and thumbnails (Imagick only) (#556)
- `Improved` Reduce quality of medium-sized images (Imagick only) (#556)
- `Improved` orientation-handling with Imagick (#556)
## v3.1.1
Released April 30, 2016
@ -6,7 +16,7 @@ Released April 30, 2016
- `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` 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)

@ -14,7 +14,8 @@ final class Database {
'030000', // 3.0.0
'030001', // 3.0.1
'030003', // 3.0.3
'030100' // 3.1.0
'030100', // 3.1.0
'030102' // 3.1.2
);
/**

@ -238,7 +238,6 @@ final class Photo {
}
// Save to DB
$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__);
@ -296,7 +295,7 @@ final class Photo {
Plugins::get()->activate(__METHOD__, 0, func_get_args());
// Quality of thumbnails
$thumbQuality = 90;
$quality = 90;
// Size of the thumbnail
$newWidth = 200;
@ -312,9 +311,12 @@ final class Photo {
// Read image
$thumb = new Imagick();
$thumb->readImage($url);
$thumb->setImageCompressionQuality($thumbQuality);
$thumb->setImageCompressionQuality($quality);
$thumb->setImageFormat('jpeg');
// Remove metadata to save some bytes
$thumb->stripImage();
// Copy image for 2nd thumb version
$thumb2x = clone $thumb;
@ -359,12 +361,12 @@ final class Photo {
// Create thumb
fastImageCopyResampled($thumb, $sourceImg, 0, 0, $startWidth, $startHeight, $newWidth, $newHeight, $newSize, $newSize);
imagejpeg($thumb, $newUrl, $thumbQuality);
imagejpeg($thumb, $newUrl, $quality);
imagedestroy($thumb);
// Create retina thumb
fastImageCopyResampled($thumb2x, $sourceImg, 0, 0, $startWidth, $startHeight, $newWidth*2, $newHeight*2, $newSize, $newSize);
imagejpeg($thumb2x, $newUrl2x, $thumbQuality);
imagejpeg($thumb2x, $newUrl2x, $quality);
imagedestroy($thumb2x);
// Free memory
@ -395,6 +397,9 @@ final class Photo {
// Call plugins
Plugins::get()->activate(__METHOD__, 0, func_get_args());
// Quality of medium-photo
$quality = 90;
// Set to true when creation of medium-photo failed
$error = false;
@ -427,6 +432,8 @@ final class Photo {
// Adjust image
$medium->scaleImage($newWidth, $newHeight, true);
$medium->stripImage();
$medium->setImageCompressionQuality($quality);
// Save image
try { $medium->writeImage($newUrl); }
@ -472,20 +479,50 @@ final class Photo {
if (extension_loaded('imagick')&&Settings::get()['imagick']==='1') {
switch ($info['orientation']) {
$image = new Imagick();
$image->readImage($path);
case 3:
$rotateImage = 180;
$orientation = $image->getImageOrientation();
switch ($orientation) {
case Imagick::ORIENTATION_TOPLEFT:
return false;
break;
case 6:
$rotateImage = 90;
$swapSize = true;
case Imagick::ORIENTATION_TOPRIGHT:
$image->flopImage();
break;
case 8:
$rotateImage = 270;
$swapSize = true;
case Imagick::ORIENTATION_BOTTOMRIGHT:
$image->rotateImage(new ImagickPixel(), 180);
break;
case Imagick::ORIENTATION_BOTTOMLEFT:
$image->flopImage();
$image->rotateImage(new ImagickPixel(), 180);
break;
case Imagick::ORIENTATION_LEFTTOP:
$image->flopImage();
$image->rotateImage(new ImagickPixel(), -90);
$swapSize = true;
break;
case Imagick::ORIENTATION_RIGHTTOP:
$image->rotateImage(new ImagickPixel(), 90);
$swapSize = true;
break;
case Imagick::ORIENTATION_RIGHTBOTTOM:
$image->flopImage();
$image->rotateImage(new ImagickPixel(), 90);
$swapSize = true;
break;
case Imagick::ORIENTATION_LEFTBOTTOM:
$image->rotateImage(new ImagickPixel(), -90);
$swapSize = true;
break;
default:
@ -494,15 +531,13 @@ final class Photo {
}
if ($rotateImage!==0) {
$image = new Imagick();
$image->readImage($path);
$image->rotateImage(new ImagickPixel(), $rotateImage);
$image->setImageOrientation(1);
$image->writeImage($path);
$image->clear();
$image->destroy();
}
// Adjust photo
$image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT);
$image->writeImage($path);
// Free memory
$image->clear();
$image->destroy();
} else {
@ -512,6 +547,11 @@ final class Photo {
switch ($info['orientation']) {
case 1:
// do nothing
return false;
break;
case 2:
// mirror
// not yet implemented
@ -561,6 +601,7 @@ final class Photo {
}
// Recreate photo
// In this step the photos also loses its metadata :(
$newSourceImg = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newSourceImg, $sourceImg, 0, 0, 0, 0, $newWidth, $newHeight, $newWidth, $newHeight);
imagejpeg($newSourceImg, $path, 100);

@ -2,7 +2,7 @@
# ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `?` (
`id` bigint(14) NOT NULL,
`id` bigint(14) unsigned NOT NULL,
`title` varchar(100) NOT NULL DEFAULT '',
`description` varchar(1000) DEFAULT '',
`sysstamp` int(11) NOT NULL,
@ -11,4 +11,4 @@ CREATE TABLE IF NOT EXISTS `?` (
`downloadable` tinyint(1) NOT NULL DEFAULT '0',
`password` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

@ -7,6 +7,6 @@ CREATE TABLE IF NOT EXISTS `?` (
`type` varchar(11) NOT NULL,
`function` varchar(100) NOT NULL,
`line` int(11) NOT NULL,
`text` TEXT,
`text` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

@ -2,8 +2,8 @@
# ------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `?` (
`id` bigint(14) NOT NULL,
`title` varchar(100) NOT NULL,
`id` bigint(14) unsigned NOT NULL,
`title` varchar(100) NOT NULL DEFAULT '',
`description` varchar(1000) DEFAULT '',
`url` varchar(100) NOT NULL,
`tags` varchar(1000) NOT NULL DEFAULT '',
@ -20,9 +20,11 @@ CREATE TABLE IF NOT EXISTS `?` (
`focal` varchar(20) NOT NULL,
`takestamp` int(11) DEFAULT NULL,
`star` tinyint(1) NOT NULL,
`thumbUrl` varchar(50) NOT NULL,
`album` varchar(30) NOT NULL DEFAULT '0',
`checksum` VARCHAR(100) DEFAULT NULL,
`thumbUrl` char(37) NOT NULL,
`album` bigint(20) unsigned NOT NULL,
`checksum` char(40) DEFAULT NULL,
`medium` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
PRIMARY KEY (`id`),
KEY `Index_album` (`album`),
KEY `Index_star` (`star`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

@ -4,4 +4,4 @@
CREATE TABLE IF NOT EXISTS `?` (
`key` varchar(50) NOT NULL DEFAULT '',
`value` varchar(200) DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

@ -0,0 +1,73 @@
<?php
/**
* Update to version 3.1.2
*/
use Lychee\Modules\Database;
use Lychee\Modules\Response;
// Change type of the album id field
$query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `album` `album` BIGINT(14) UNSIGNED NOT NULL", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not change type of the album id field!');
// Add index to the album id field
$query = Database::prepare($connection, "SHOW INDEX FROM `?` WHERE KEY_NAME = 'Index_album'", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not check if Index_album exists!');
if ($result->num_rows===0) {
$query = Database::prepare($connection, "ALTER TABLE `?` ADD INDEX `Index_album` (`album`)", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not add index to the album id field!');
}
// Add index to the star field
$query = Database::prepare($connection, "SHOW INDEX FROM `?` WHERE KEY_NAME = 'Index_star'", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not check if Index_star exists!');
if ($result->num_rows===0) {
$query = Database::prepare($connection, "ALTER TABLE `?` ADD INDEX `Index_star` (`star`)", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not add index to the star field!');
}
// Change type of the checksum field
$query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `checksum` `checksum` CHAR(40) NULL DEFAULT NULL", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not change type of the checksum field!');
// Change type of the thumbUrl field
$query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `thumbUrl` `thumbUrl` CHAR(37) NOT NULL", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not change type of the thumbUrl field!');
// Change type of the id field
$query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `id` `id` BIGINT(14) UNSIGNED NOT NULL", array(LYCHEE_TABLE_PHOTOS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not change type of the id field!');
// Change type of the id field
$query = Database::prepare($connection, "ALTER TABLE `?` CHANGE `id` `id` BIGINT(14) UNSIGNED NOT NULL", array(LYCHEE_TABLE_ALBUMS));
$result = Database::execute($connection, $query, 'update_030102', __LINE__);
if ($result===false) Response::error('Could not change type of the id field!');
// Set version
if (Database::setVersion($connection, '030102')===false) Response::error('Could not update version of database!');
?>

@ -24,8 +24,8 @@ function getGraphHeader($photoID) {
else $dir = 'big';
$parseUrl = parse_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$url = $parseUrl['scheme'] . '://' . $parseUrl['host'] . $parseUrl['path'] . '?' . $parseUrl['query'];
$picture = $parseUrl['scheme'] . '://' . $parseUrl['host'] . $parseUrl['path'] . '/../uploads/' . $dir . '/' . $row->url;
$url = '//' . $parseUrl['host'] . $parseUrl['path'] . '?' . $parseUrl['query'];
$picture = '//' . $parseUrl['host'] . $parseUrl['path'] . '/../uploads/' . $dir . '/' . $row->url;
$url = htmlentities($url);
$picture = htmlentities($picture);

@ -1,6 +1,6 @@
{
"name": "Lychee",
"version": "3.1.1",
"version": "3.1.2",
"description": "Self-hosted photo-management done right.",
"authors": "Tobias Reich <tobias@electerious.com>",
"license": "MIT",

@ -6,8 +6,8 @@
lychee = {
title : document.title,
version : '3.1.1',
versionCode : '030101',
version : '3.1.2',
versionCode : '030102',
updatePath : '//update.electerious.com/index.json',
updateURL : 'https://github.com/electerious/Lychee',

Loading…
Cancel
Save