MDL-65557 forum: increase default image size of author profile url

This commit is contained in:
Ryan Wyllie 2019-05-13 16:25:14 +08:00
parent 6a7451ff1b
commit 6489aa2a45
4 changed files with 22 additions and 12 deletions

View File

@ -408,16 +408,21 @@ class url {
*
* @param author_entity $author The author
* @param int|null $authorcontextid The author context id
* @param int $size The size of the image to return
* @return moodle_url
*/
public function get_author_profile_image_url(author_entity $author, int $authorcontextid = null) : moodle_url {
public function get_author_profile_image_url(
author_entity $author,
int $authorcontextid = null,
int $size = 100
) : moodle_url {
global $PAGE;
$datamapper = $this->legacydatamapperfactory->get_author_data_mapper();
$record = $datamapper->to_legacy_object($author);
$record->contextid = $authorcontextid;
$userpicture = new user_picture($record);
$userpicture->size = 2;
$userpicture->size = $size;
return $userpicture->get_url($PAGE);
}

View File

@ -952,12 +952,12 @@ class mod_forum_external extends external_api {
} else {
$discussionobject->userfullname = $firstpostauthor->get_full_name();
$discussionobject->userpictureurl = $urlfactory->get_author_profile_image_url($firstpostauthor)
$discussionobject->userpictureurl = $urlfactory->get_author_profile_image_url($firstpostauthor, null, 2)
->out(false);
$discussionobject->usermodifiedfullname = $latestpostauthor->get_full_name();
$discussionobject->usermodifiedpictureurl = $urlfactory->get_author_profile_image_url($latestpostauthor)
->out(false);
$discussionobject->usermodifiedpictureurl = $urlfactory->get_author_profile_image_url(
$latestpostauthor, null, 2)->out(false);
}
$discussions[] = (array) $discussionobject;

View File

@ -216,6 +216,11 @@
margin: 5px 0;
}
.discussion-list .userpicture {
height: 35px;
width: 35px;
}
/** Styles for search.php */
#page-mod-forum-search .introcontent {
padding: 15px;

View File

@ -61,7 +61,7 @@
{{#str}} showingcountoftotaldiscussions, mod_forum, {"count": "{{visiblediscussioncount}}", "total":"{{totaldiscussioncount}}"} {{/str}}
</span>
<table
class="table table-hover table-striped"
class="table table-hover table-striped discussion-list"
aria-label='{{#str}} showingcountoftotaldiscussions, mod_forum, {"count": "{{visiblediscussioncount}}", "total":"{{totaldiscussioncount}}"} {{/str}}'
aria-describedby="discussion-table-description-{{uniqid}}"
>
@ -152,7 +152,7 @@
<div class="d-flex flex-row">
<div class="align-middle p-0">
<img
class="h-auto rounded-circle userpicture"
class="rounded-circle userpicture"
src="{{urls.profileimage}}"
alt="{{#str}}pictureof, moodle, {{fullname}}{{/str}}"
>
@ -216,11 +216,11 @@
<div class="d-flex flex-row">
<div class="align-middle p-0">
<a href="{{latestpostauthor.urls.profile}}">
<img {{!
}} class="h-auto rounded-circle userpicture" {{!
}} src="{{latestpostauthor.urls.profileimage}}" {{!
}} alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}" {{!
}}>
<img
class="rounded-circle userpicture"
src="{{latestpostauthor.urls.profileimage}}"
alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}"
>
</a>
</div>
<div class="p-2 p-t-0 p-b-0 d-inline-flex flex-column">