Merge pull request #18892 from nextcloud/fix/17828/smaller_text_previews

Proper text previews
This commit is contained in:
Roeland Jago Douma 2020-01-15 07:24:12 +01:00 committed by GitHub
commit 9daf35b704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -176,6 +176,7 @@ export default {
starred: this.fileInfo.isFavourited,
subtitle: this.subtitle,
title: this.fileInfo.name,
'data-mimetype': this.fileInfo.mimetype,
}
} else if (this.error) {
return {
@ -381,8 +382,17 @@ export default {
</script>
<style lang="scss" scoped>
#app-sidebar {
&.has-preview::v-deep .app-sidebar-header__figure {
background-size: cover;
&.has-preview::v-deep {
.app-sidebar-header__figure {
background-size: cover;
}
&[data-mimetype="text/plain"],
&[data-mimetype="text/markdown"] {
.app-sidebar-header__figure {
background-size: contain;
}
}
}
}
</style>

View File

@ -68,7 +68,7 @@ class TXT extends ProviderV2 {
$lines = preg_split("/\r\n|\n|\r/", $content);
// Define text size of text file preview
$fontSize = $maxX ? (int) ((2 / 32) * $maxX) : 5; //5px
$fontSize = $maxX ? (int) ((1 / 32) * $maxX) : 5; //5px
$lineSize = ceil($fontSize * 1.5);
$image = imagecreate($maxX, $maxY);