Merge pull request #19468 from owncloud/fix-36-vs-32-previews

Change small thumbnails to 32 px
This commit is contained in:
Thomas Müller 2015-09-30 15:47:34 +02:00
commit 1d8c10cf63
9 changed files with 15 additions and 15 deletions

View File

@ -1411,10 +1411,10 @@
generatePreviewUrl: function(urlSpec) {
urlSpec = urlSpec || {};
if (!urlSpec.x) {
urlSpec.x = this.$table.data('preview-x') || 36;
urlSpec.x = this.$table.data('preview-x') || 32;
}
if (!urlSpec.y) {
urlSpec.y = this.$table.data('preview-y') || 36;
urlSpec.y = this.$table.data('preview-y') || 32;
}
urlSpec.x *= window.devicePixelRatio;
urlSpec.y *= window.devicePixelRatio;

View File

@ -51,7 +51,7 @@
<p></p>
</div>
<table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="36" data-preview-y="36">
<table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="32" data-preview-y="32">
<thead>
<tr>
<th id='headerName' class="hidden column-name">

View File

@ -28,8 +28,8 @@ OCP\JSON::checkAppEnabled('files_sharing');
\OC_User::setIncognitoMode(true);
$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '32';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '32';
$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
$token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : '';
$keepAspect = array_key_exists('a', $_GET) ? true : false;

View File

@ -161,10 +161,10 @@ OCA.Sharing.PublicApp = {
this.fileList.generatePreviewUrl = function (urlSpec) {
urlSpec = urlSpec || {};
if (!urlSpec.x) {
urlSpec.x = 36;
urlSpec.x = 32;
}
if (!urlSpec.y) {
urlSpec.y = 36;
urlSpec.y = 32;
}
urlSpec.x *= window.devicePixelRatio;
urlSpec.y *= window.devicePixelRatio;

View File

@ -908,6 +908,6 @@ class Trashbin {
* @return string
*/
public static function preview_icon($path) {
return \OCP\Util::linkToRoute('core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => $path));
return \OCP\Util::linkToRoute('core_ajax_trashbin_preview', array('x' => 32, 'y' => 32, 'file' => $path));
}
}

View File

@ -26,8 +26,8 @@
\OC::$server->getSession()->close();
$file = array_key_exists('file', $_GET) ? (string)$_GET['file'] : '';
$maxX = array_key_exists('x', $_GET) ? (int)$_GET['x'] : '36';
$maxY = array_key_exists('y', $_GET) ? (int)$_GET['y'] : '36';
$maxX = array_key_exists('x', $_GET) ? (int)$_GET['x'] : '32';
$maxY = array_key_exists('y', $_GET) ? (int)$_GET['y'] : '32';
$scalingUp = array_key_exists('scalingup', $_GET) ? (bool)$_GET['scalingup'] : true;
$keepAspect = array_key_exists('a', $_GET) ? true : false;
$always = array_key_exists('forceIcon', $_GET) ? (bool)$_GET['forceIcon'] : true;

View File

@ -193,11 +193,11 @@ class OC_Helper {
* Returns the path to the preview of the file.
*/
public static function previewIcon($path) {
return self::linkToRoute( 'core_ajax_preview', array('x' => 36, 'y' => 36, 'file' => $path ));
return self::linkToRoute( 'core_ajax_preview', array('x' => 32, 'y' => 32, 'file' => $path ));
}
public static function publicPreviewIcon( $path, $token ) {
return self::linkToRoute( 'core_ajax_public_preview', array('x' => 36, 'y' => 36, 'file' => $path, 't' => $token));
return self::linkToRoute( 'core_ajax_public_preview', array('x' => 32, 'y' => 32, 'file' => $path, 't' => $token));
}
/**

View File

@ -53,7 +53,7 @@ class TXT extends Provider {
$lines = preg_split("/\r\n|\n|\r/", $content);
$fontSize = ($maxX) ? (int) ((5 / 36) * $maxX) : 5; //5px
$fontSize = ($maxX) ? (int) ((5 / 32) * $maxX) : 5; //5px
$lineSize = ceil($fontSize * 1.25);
$image = imagecreate($maxX, $maxY);

View File

@ -534,10 +534,10 @@ class Preview extends TestCase {
// Small thumbnails are always cropped
$this->keepAspect = false;
// Smaller previews should be based on the previous, larger preview, with the correct aspect ratio
$this->createThumbnailFromBiggerCachedPreview($fileId, 36, 36);
$this->createThumbnailFromBiggerCachedPreview($fileId, 32, 32);
// 2nd cache query should indicate that we have a cached copy of the exact dimension
$this->getCachedSmallThumbnail($fileId, 36, 36);
$this->getCachedSmallThumbnail($fileId, 32, 32);
// We create a preview in order to be able to delete the cache
$preview = $this->createPreview(rand(), rand());