Merge pull request #7953 from nextcloud/theming-background-highres

Theming: adjust background image resizing
This commit is contained in:
Morris Jobke 2018-01-19 14:14:25 +01:00 committed by GitHub
commit 34a3613a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -288,12 +288,10 @@ class ThemingController extends Controller {
// Optimize the image since some people may upload images that will be
// either to big or are not progressive rendering.
$tmpFile = $this->tempManager->getTemporaryFile();
if (function_exists('imagescale')) {
// FIXME: Once PHP 5.5.0 is a requirement the above check can be removed
// Workaround for https://bugs.php.net/bug.php?id=65171
$newHeight = imagesy($image) / (imagesx($image) / 1920);
$image = imagescale($image, 1920, $newHeight);
}
$newWidth = imagesx($image) < 4096 ? imagesx($image) : 4096;
$newHeight = imagesy($image) / (imagesx($image) / $newWidth);
$image = imagescale($image, $newWidth, $newHeight);
imageinterlace($image, 1);
imagejpeg($image, $tmpFile, 75);
imagedestroy($image);