1
Mods & Plugins (Releases & Support) / Re: [Mod] Avatar v2.01
« on: May 29, 2020, 01:29:32 AM »
This Mod ready for gallery 1.8 and php 7+, but need this changes:
New step 1.4.
Few lines below find:
Replace with:
New step 3.6.
Find:
Insert above:
Enjoy!
New step 1.4.
Few lines below find:
Code: [Select]
$site_template->register_vars(array(
"user_name" => format_text(stripslashes($user_name), 2),
Replace with:
Code: [Select]
//-----------------------
//------ Avatar ---------
//-----------------------
if ($config['avatar_use']){
$images = "";
$checked = ($user_avatar == "blank.gif" || $user_avatar == "") ? " selected" : "";
$images .= "\n<option value=\"blank.gif\"$checked>none</option>\n";
$dir = opendir(TEMPLATE_PATH."/avatars/users/");
$contents = array();
while ($contents[] = readdir($dir)){;}
closedir($dir);
natcasesort ($contents);
foreach ($contents as $line){
$filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
if ($filename == $user_info['user_id']) {
$checked = (stristr($user_avatar, "users/")) ? " selected" : "";
$images .= "\n<option value=\"users/$line\"$checked>".$lang['custom']."</option>\n";
}
}
$dir = opendir(TEMPLATE_PATH."/avatars/");
$contents = array();
while ($contents[] = readdir($dir)){;}
closedir($dir);
natcasesort ($contents);
$checked = "";
foreach ($contents as $line){
$filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
$extension = substr(strrchr($line,"."), 1);
$checked = "";
if ($line == $user_avatar) { $checked = " selected"; }
if (strcasecmp($extension,"gif")==0 || strcasecmp($extension,"jpg")==0 || strcasecmp($extension,"jpeg")==0 || strcasecmp($extension,"png")==0 ){
if ($line != "blank.gif") {
$filename = str_replace("_", " ", $filename);
$images .= "<option value=\"$line\"$checked>$filename</option>\n";
}
}
}
}
//----------------------
//----- End Avatar -----
//----------------------
$site_template->register_vars(array(
"lang_avatar" => $lang['avatar'],
"lang_avatar_file" => $lang['avatar_file'],
"lang_avatar_dim" => $lang['avatar_max_dim']." ".$config['avatar_width']."x".$config['avatar_height'].$lang['px'],
"lang_avatar_select" => $lang['avatar_select'],
"user_avatar_images" => $images,
"user_avatar_current" => ($config['avatar_use']) ? "<img src=\"".TEMPLATE_PATH."/avatars/".(($user_avatar == "") ? "blank.gif" : $user_avatar)."\" name=\"icons\" border=\"0\" alt=\"\">" : "",
"lang_or" => $lang['or'],
"user_avatar_file" => $config['avatar_user_custom'],
"user_name" => format_text(stripslashes($user_name), 2),
New step 3.6.
Find:
Code: [Select]
//Thumbnails
$this->accepted_extensions['thumb'] = array(
Insert above:
Code: [Select]
//Avatar
$this->accepted_mime_types['avatar'] = array(
"image/jpeg",
"image/pjpeg",
"image/gif",
"image/x-png"
);
$this->accepted_extensions['avatar'] = array(
"jpg",
"jpeg",
"gif",
"png"
);
Enjoy!