summaryrefslogtreecommitdiffstats
path: root/apps/files/js/mainfileinfodetailview.js
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-09-28 14:04:43 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-09-29 13:07:08 +0200
commita40a2b0d64299bc2114c2700a32014110826205f (patch)
tree5401ea2fe107189df75bf709a7344ba160786f1f /apps/files/js/mainfileinfodetailview.js
parent222a4bd4ac7c3d0ce76564a3f0cad9237d121b87 (diff)
downloadnextcloud-server-a40a2b0d64299bc2114c2700a32014110826205f.tar.gz
nextcloud-server-a40a2b0d64299bc2114c2700a32014110826205f.zip
improve handling of small images
Diffstat (limited to 'apps/files/js/mainfileinfodetailview.js')
-rw-r--r--apps/files/js/mainfileinfodetailview.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js
index 7f2528737d5..a74534e68e7 100644
--- a/apps/files/js/mainfileinfodetailview.js
+++ b/apps/files/js/mainfileinfodetailview.js
@@ -148,6 +148,10 @@
return img.width > (img.height * 1.2);
};
+ var isSmall = function(img) {
+ return (img.width * 1.1) < (maxImageWidth * window.devicePixelRatio);
+ };
+
var getTargetHeight = function(img) {
if(isImage) {
var targetHeight = img.height / window.devicePixelRatio;
@@ -178,7 +182,7 @@
$iconDiv.removeClass('icon-loading icon-32');
var targetHeight = getTargetHeight(img);
if (this.model.isImage() && targetHeight > smallPreviewSize) {
- $container.addClass(isLandscape(img)? 'landscape': 'portrait');
+ $container.addClass((isLandscape(img) && !isSmall(img))? 'landscape': 'portrait');
$container.addClass('image');
}
@@ -186,7 +190,8 @@
// when we dont have a preview we show the mime icon in the error handler
$iconDiv.css({
'background-image': 'url("' + previewUrl + '")',
- height: (targetHeight > smallPreviewSize)? 'auto': targetHeight
+ height: (targetHeight > smallPreviewSize)? 'auto': targetHeight,
+ 'max-height': isSmall(img)? targetHeight: null
});
}.bind(this),
error: function () {
teger */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<?xml version="1.0"?>
<psalm
	errorLevel="4"
	resolveFromConfigFile="true"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="https://getpsalm.org/schema/config"
	xsi:schemaLocation="https://getpsalm.org/schema/config"
    errorBaseline="build/psalm-baseline.xml"
>
	<plugins>
		<plugin filename="build/psalm/AppFrameworkTainter.php" />
	</plugins>
	<projectFiles>
		<directory name="apps/accessibility"/>
		<directory name="apps/admin_audit"/>
		<directory name="apps/cloud_federation_api"/>
		<directory name="apps/comments"/>
		<directory name="apps/contactsinteraction"/>
		<directory name="apps/dashboard"/>
		<directory name="apps/dav"/>
		<directory name="apps/encryption"/>
		<directory name="apps/federatedfilesharing"/>
		<directory name="apps/federation"/>
		<directory name="apps/files"/>
		<directory name="apps/files_external"/>
		<directory name="apps/files_sharing"/>
		<directory name="apps/files_trashbin"/>
		<directory name="apps/files_versions"/>
		<directory name="apps/lookup_server_connector"/>
		<directory name="apps/oauth2"/>
		<directory name="apps/provisioning_api"/>
		<directory name="apps/settings"/>
		<directory name="apps/sharebymail"/>
		<directory name="apps/systemtags"/>
		<directory name="apps/testing"/>
		<directory name="apps/theming"/>
		<directory name="apps/twofactor_backupcodes"/>
		<directory name="apps/updatenotification"/>
		<directory name="apps/user_ldap"/>
		<directory name="apps/user_status"/>
		<directory name="apps/weather_status"/>
		<directory name="apps/workflowengine"/>
		<directory name="core"/>
		<directory name="lib"/>
		<directory name="ocm-provider"/>
		<directory name="ocs"/>
		<directory name="ocs-provider"/>
		<file name="index.php"/>
		<file name="public.php"/>
		<file name="remote.php"/>
		<file name="status.php"/>
		<file name="version.php"/>
		<ignoreFiles>
			<directory name="apps/**/composer"/>
			<directory name="apps/**/tests"/>
			<directory name="apps/files_external/3rdparty"/>
			<directory name="lib/composer"/>
			<directory name="lib/l10n"/>
		</ignoreFiles>
	</projectFiles>
	<extraFiles>
		<directory name="3rdparty"/>
		<directory name="apps/files_external/3rdparty"/>
	</extraFiles>
	<stubs>
		<file name="build/stubs/apcu.php"/>
		<file name="build/stubs/gd.php"/>
		<file name="build/stubs/imagick.php"/>
		<file name="build/stubs/intl.php"/>
		<file name="build/stubs/IntlChar.php"/>
		<file name="build/stubs/ldap.php"/>
		<file name="build/stubs/memcached.php"/>
		<file name="build/stubs/redis.php"/>
		<file name="build/stubs/redis_cluster.php"/>
		<file name="build/stubs/sftp.php"/>
		<file name="build/stubs/ssh2.php"/>
		<file name="build/stubs/xsl.php"/>
	</stubs>
	<issueHandlers>
		<UndefinedFunction>
			<errorLevel type="suppress">
				<!-- template functions: https://github.com/nextcloud/server/blob/6e8e34fef920a073118c22111f0f31eb3b3a91dc/lib/private/legacy/template/functions.php -->
				<referencedFunction name="p"/>
				<referencedFunction name="emit_css_tag"/>
				<referencedFunction name="emit_css_loading_tags"/>
				<referencedFunction name="emit_script_tag"/>
				<referencedFunction name="emit_script_loading_tags"/>
				<referencedFunction name="print_unescaped"/>
				<referencedFunction name="script"/>
				<referencedFunction name="vendor_script"/>
				<referencedFunction name="style"/>
				<referencedFunction name="vendor_style"/>
				<referencedFunction name="translation"/>
				<referencedFunction name="component"/>
				<referencedFunction name="link_to"/>
				<referencedFunction name="link_to_docs"/>
				<referencedFunction name="image_path"/>
				<referencedFunction name="mimetype_icon"/>
				<referencedFunction name="preview_icon"/>
				<referencedFunction name="publicPreview_icon"/>
				<referencedFunction name="human_file_size"/>
				<referencedFunction name="strip_time"/>
				<referencedFunction name="relative_modified_date"/>
				<referencedFunction name="html_select_options"/>
			</errorLevel>
		</UndefinedFunction>
		<UndefinedGlobalVariable>
			<errorLevel type="suppress">
				<referencedVariable name="$_"/>
				<referencedVariable name="$l"/>
				<referencedVariable name="$theme"/>
				<!-- false positive: https://github.com/nextcloud/server/blob/cb057829f72c70e819f456edfadbb29d72dba832/lib/private/Console/Application.php#L92 -->
				<file name="core/register_command.php" />
			</errorLevel>
		</UndefinedGlobalVariable>
		<UndefinedDocblockClass>
			<errorLevel type="suppress">
				<!-- Helper classes for sharing API integration from other apps -->
				<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
				<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
			</errorLevel>
		</UndefinedDocblockClass>
	</issueHandlers>
</psalm>