mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/15769] Adjust loading of images for cropping and add some docblocks
PHPBB3-15769
This commit is contained in:
parent
1933a8ab47
commit
b3308245c3
2 changed files with 17 additions and 1 deletions
|
@ -44,7 +44,15 @@
|
|||
// Correctly position the cropper buttons
|
||||
this.$buttons.appendTo(this.$box);
|
||||
|
||||
this.image = this.$box.children('img');
|
||||
// Ensure we have an img for the cropping
|
||||
if (this.$box.children('img').length === 0) {
|
||||
const $avatarImg = $('<img/>');
|
||||
$avatarImg.addClass('avatar');
|
||||
this.image = $avatarImg;
|
||||
this.$box.prepend($avatarImg);
|
||||
} else {
|
||||
this.image = this.$box.children('img');
|
||||
}
|
||||
|
||||
this.bindInput();
|
||||
this.bindSelect();
|
||||
|
@ -111,6 +119,9 @@
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Bind submit button to be handled by ajax submit
|
||||
*/
|
||||
bindSubmit() {
|
||||
const $this = this;
|
||||
$this.$form = this.$input.closest('form');
|
||||
|
@ -160,6 +171,10 @@
|
|||
return originalName.replace(/\.[^/\\.]+$/, '.png');
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle response from avatar submission
|
||||
* @param {Object} response AJAX response object
|
||||
*/
|
||||
uploadDone(response) {
|
||||
if (typeof response !== 'object') {
|
||||
return;
|
||||
|
|
|
@ -359,6 +359,7 @@ ol.def-rules li {
|
|||
|
||||
.c-cropper-avatar-box {
|
||||
min-height: 240px;
|
||||
max-height: 400px;
|
||||
}
|
||||
|
||||
p.notification-title,
|
||||
|
|
Loading…
Add table
Reference in a new issue