You have to install phpThumbOf extra or better pThumb - http://modx.com/extras/package/pthumb to make the avatar images smaller in the upload section.
pThumb works faster then phpThumbOf, but you have to uninstall the phpThumbOf first if you want to install pThumb.
It works with the same syntax like phpThumbOf, so you don't have to replace the code.
pThumb System settings:
Go to System - System Settings - choose phpthumbof from the dropdown menu:
Check file modification time phpthumbof.check_mod_time Yes (by default No - image in Update section remain the first uploaded,
if Yes the image in the Update profile page is the actual one);
* issue:
When updating profile with new avatar, after the update the old avatar remains in the forum pages.
After refreshing the page the new one pop up. It can be happen because of the subdomain testing.
Things to do:
Finding where the [[+avatar]] code comes from and replace the image source above (assets/userfiles/[[+username]]/avatar.gif) within.
In this situation there will be no need to specify the extension .gif and the uploaded image files in the snippet .
/* Avatar image in Header @wrapper.tpl*/
core/components/discuss/themes/default/pages/wrapper.tpl
Line 47-48
Replaced <img src="[[+discuss.user.avatar_url]]" alt="[[+discuss.user.username]]'s Avatar">
with
<img src="[[+site_url]]assets/userfiles/[[+discuss.user.username]]/avatar.gif" alt="[[+discuss.user.username]]'s Avatar">
---
/* Avatar image in Post @disthreadpost.chunk.tpl */
core/components/discuss/themes/default/chunks/post/disthreadpost.chunk.tpl
Line 35-36
Replaced <img src="[[+author.avatar]]" alt="[[+author.username]]">
with
<img src="assets/userfiles/[[+author.username]]/avatar.gif" alt="[[+author.username]]">
---
/* Avatar image in Preview Post @dispostpreview.chunk.tpl */
core/components/discuss/themes/default/chunks/post/dispostpreview.chunk.tpl
Line 5-6
Replaced <img src="[[+author.avatar]]" alt="[[+author.username]]">
with
<img src="assets/userfiles/[[+author.username]]/avatar.gif" alt="[[+author.username]]">
---
/* Avatar image in Profile Page Sidebar @user-sidebar.chunk.tpl */
core/components/discuss/themes/default/modules/user-sidebar.chunk.tpl
Line 7
Changing the link https://en.gravatar.com/site/login#your-images
to Edit Profile Link
https://www.rayxilawforums.com/forums/login/update-profile.html?discuss=1
Line 8
Replaced <img src="[[+avatarUrl]]" alt="[[+username]]" />
with
<img src="assets/userfiles/[[+username]]/avatar.gif" alt="[[+username]]">
You have to style the PanelBox-avatar image in the css file to be 80x80px (by default the images are getting their default resolution):
/assets/components/discuss/themes/default/css/redo/forums-styles.css
.PanelBox-avatar img{width:80px;height:80px}
.m-profile-box li.Heading img {
height: 80px;
width: 80px;
}
<?php //LINE 13 IS IMPORTANT - PATH WHERE THE AVATARS ARE SAVED //LINE 41 IS IMPORTANT - FILE NAME // initialize output; $output = true; // get the current user name to for dicroty placement $userName = $modx->user->get('username'); // valid extensions $ext_array = array('jpg', 'jpeg', 'gif', 'png'); // create unique path for this form submission $uploadpath = 'assets/userfiles/' . $userName .'/'; // get full path to unique folder $target_path = $modx->config['base_path'] . $uploadpath; // get uploaded file names: $submittedfiles = array_keys($_FILES); //get exsisting user profile data for Profile_Photos $fields = $modx->user->getOne('Profile')->get('extended'); $Photo_fields = $fields['Profile_Photos']; // loop through files foreach ($submittedfiles as $sf) { // Get Filename and make sure its good. $filename = basename( $_FILES[$sf]['name'] ); // Get file's extension $ext = pathinfo($filename, PATHINFO_EXTENSION); $ext = mb_strtolower($ext); // case insensitive if($filename != '') { $modx->log(modX::LOG_LEVEL_ERROR,'in file name loop'.$filename); // is this the right type of file? if(in_array($ext, $ext_array)) { //create file called the filename that has been sanitized //$filename = strtolower(preg_replace("/[^A-Za-z0-9.]+/i", "-", $filename)); //$filename = $filename . '.'.$ext ; $filename = avatar . '.'.gif ; //replaced $filename . '.'.$ext with avatar .gif because of avatar_url chunk; // full path to new file $myTarget = $target_path . $filename; // create directory to move file into if it doesn't exist mkdir($target_path, 0755, true); if(file_exists($myTarget)) { chmod($myTarget,0755); //Change the file permissions if allowed unlink($myTarget); //remove the file } // is the file moved to the proper folder successfully? if(move_uploaded_file($_FILES[$sf]['tmp_name'], $myTarget)) { // set a new placeholder with the new full path (if you need it in subsequent hooks) $hook->setValue($sf, $uploadpath . $filename); // set the permissions on the file if (!chmod($myTarget, 0644)) { /*some debug function*/ } } else { // File not uploaded $errorMsg = 'There was a problem uploading the file.'; $hook->addError($sf, $errorMsg); $output = false; // generate submission error } } else { // File type not allowed $errorMsg = 'Type of file not allowed.'; $hook->addError($sf, $errorMsg); $output = false; // generate submission error } } else { //check to see if there is exsisting photofields value and return value if so if ($Photo_fields != '') { $hook->setValue($sf, $Photo_fields); } else{ // if no file, don't error, but return blank // is the file name empty (no file uploaded) and exsiting photofields empty $hook->setValue($sf, ''); } } } return $output;