Allow images of any size as profile pictures

Signed-off-by: Marco <marcoambrosini@icloud.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Signed-off-by: Simon L <szaimen@e.mail.de>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This commit is contained in:
Simon L 2023-04-17 16:48:47 +02:00 committed by nextcloud-command
parent e63720b714
commit 1ef23e7708
3 changed files with 8 additions and 5 deletions

View file

@ -61,7 +61,7 @@
</template>
</NcButton>
</div>
<span>{{ t('settings', 'png or jpg, max. 20 MB') }}</span>
<span>{{ t('settings', 'The file must be a PNG or JPG') }}</span>
<input ref="input"
:id="inputId"
type="file"
@ -226,7 +226,10 @@ export default {
this.showCropper = false
this.loading = true
this.$refs.cropper.getCroppedCanvas().toBlob(async (blob) => {
const canvasData = this.$refs.cropper.getCroppedCanvas()
const scaleFactor = canvasData.width > 512 ? 512 / canvasData.width : 1
this.$refs.cropper.scale(scaleFactor, scaleFactor).getCroppedCanvas().toBlob(async (blob) => {
if (blob === null) {
showError(t('settings', 'Error cropping profile picture'))
this.cancel()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long