1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import * as Utils from 'utils/utils.jsx';
import AdminSettings from './admin_settings.jsx';
import {FormattedMessage} from 'react-intl';
import SettingsGroup from './settings_group.jsx';
import TextSetting from './text_setting.jsx';
export default class ImageSettings extends AdminSettings {
constructor(props) {
super(props);
this.getConfigFromState = this.getConfigFromState.bind(this);
this.renderSettings = this.renderSettings.bind(this);
this.state = Object.assign(this.state, {
thumbnailWidth: props.config.FileSettings.ThumbnailWidth,
thumbnailHeight: props.config.FileSettings.ThumbnailHeight,
profileWidth: props.config.FileSettings.ProfileWidth,
profileHeight: props.config.FileSettings.ProfileHeight,
previewWidth: props.config.FileSettings.PreviewWidth,
previewHeight: props.config.FileSettings.PreviewHeight
});
}
getConfigFromState(config) {
config.FileSettings.ThumbnailWidth = this.parseInt(this.state.thumbnailWidth);
config.FileSettings.ThumbnailHeight = this.parseInt(this.state.thumbnailHeight);
config.FileSettings.ProfileWidth = this.parseInt(this.state.profileWidth);
config.FileSettings.ProfileHeight = this.parseInt(this.state.profileHeight);
config.FileSettings.PreviewWidth = this.parseInt(this.state.previewWidth);
config.FileSettings.PreviewHeight = this.parseInt(this.state.previewHeight);
return config;
}
renderTitle() {
return (
<h3>
<FormattedMessage
id='admin.files.title'
defaultMessage='File Settings'
/>
</h3>
);
}
renderSettings() {
return (
<SettingsGroup
header={
<FormattedMessage
id='admin.files.images'
defaultMessage='Images'
/>
}
>
<TextSetting
id='thumbnailWidth'
label={
<FormattedMessage
id='admin.image.thumbWidthTitle'
defaultMessage='Thumbnail Width:'
/>
}
placeholder={Utils.localizeMessage('admin.image.thumbWidthExample', 'Ex "120"')}
helpText={
<FormattedMessage
id='admin.image.thumbWidthDescription'
defaultMessage='Width of thumbnails generated from uploaded images. Updating this value changes how thumbnail images render in future, but does not change images created in the past.'
/>
}
value={this.state.thumbnailWidth}
onChange={this.handleChange}
/>
<TextSetting
id='thumbnailHeight'
label={
<FormattedMessage
id='admin.image.thumbHeightTitle'
defaultMessage='Thumbnail Height:'
/>
}
placeholder={Utils.localizeMessage('admin.image.thumbHeightExample', 'Ex "100"')}
helpText={
<FormattedMessage
id='admin.image.thumbHeightDescription'
defaultMessage='Height of thumbnails generated from uploaded images. Updating this value changes how thumbnail images render in future, but does not change images created in the past.'
/>
}
value={this.state.thumbnailHeight}
onChange={this.handleChange}
/>
<TextSetting
id='profileWidth'
label={
<FormattedMessage
id='admin.image.profileWidthTitle'
defaultMessage='Profile Width:'
/>
}
placeholder={Utils.localizeMessage('admin.image.profileWidthExample', 'Ex "1024"')}
helpText={
<FormattedMessage
id='admin.image.profileWidthDescription'
defaultMessage='Width of profile picture.'
/>
}
value={this.state.profileWidth}
onChange={this.handleChange}
/>
<TextSetting
id='profileHeight'
label={
<FormattedMessage
id='admin.image.profileHeightTitle'
defaultMessage='Profile Height:'
/>
}
placeholder={Utils.localizeMessage('admin.image.profileHeightExample', 'Ex "0"')}
helpText={
<FormattedMessage
id='admin.image.profileHeightDescription'
defaultMessage='Height of profile picture.'
/>
}
value={this.state.profileHeight}
onChange={this.handleChange}
/>
<TextSetting
id='previewWidth'
label={
<FormattedMessage
id='admin.image.previewWidthTitle'
defaultMessage='Preview Width:'
/>
}
placeholder={Utils.localizeMessage('admin.image.previewWidthExample', 'Ex "1024"')}
helpText={
<FormattedMessage
id='admin.image.previewWidthDescription'
defaultMessage='Maximum width of preview image. Updating this value changes how preview images render in future, but does not change images created in the past.'
/>
}
value={this.state.previewWidth}
onChange={this.handleChange}
/>
<TextSetting
id='previewHeight'
label={
<FormattedMessage
id='admin.image.previewHeightTitle'
defaultMessage='Preview Height:'
/>
}
placeholder={Utils.localizeMessage('admin.image.previewHeightExample', 'Ex "0"')}
helpText={
<FormattedMessage
id='admin.image.previewHeightDescription'
defaultMessage='Maximum height of preview image ("0": Sets to auto-size). Updating this value changes how preview images render in future, but does not change images created in the past.'
/>
}
value={this.state.previewHeight}
onChange={this.handleChange}
/>
</SettingsGroup>
);
}
}
|