Файл: sys/fnc/avatar.php
Строк: 38
<?php
/* DCMS Special
* Дата последнего редактирования 10.12.2015
* Модифицировал densnet
*/
function avatar($id, $px = '40', $style = null) {
global $set;
$ank = get_user($id);
if ($ank['sex'] == 0) {
$sex = 'zh.jpg';
} else {
$sex = 'm.jpg';
}
if (is_file(H . "user/avatar/$id.gif")) {
echo "<img src='/user/avatar/$id.gif' style='width: {$px}px;height: {$px}px; $style' class = 'avatar'/>n";
} elseif (is_file(H . "user/avatar/$id.jpg")) {
echo "<img src='/user/avatar/$id.jpg' style='width: {$px}px;height: {$px}px; $style' class = 'avatar'/>n";
} elseif (is_file(H . "user/avatar/$id.png")) {
echo "<img src='/user/avatar/$id.png' style='width: {$px}px;height: {$px}px; $style' class = 'avatar'/>n";
} else {
echo "<img src='/user/avatar/$sex' style='width: {$px}px;height: {$px}px; $style' class = 'avatar'/>n";
}
}
function avatars($id, $px = '40') {
global $set;
$ank = get_user($id);
if ($ank['sex'] == 0) {
$sex = 'zh.jpg';
} else {
$sex = 'm.jpg';
}
if (is_file(H . "user/avatar/$id.gif")) {
echo "<img src='/user/avatar/$id.gif' style = 'width: {$px}px;height: {$px}px' class = 'img-circle media-object'/>n";
} elseif (is_file(H . "user/avatar/$id.jpg")) {
echo "<img src='/user/avatar/$id.jpg' style = 'width: {$px}px;height: {$px}px' class = 'img-circle media-object'/>n";
} elseif (is_file(H . "user/avatar/$id.png")) {
echo "<img src='/user/avatar/$id.png' style = 'width: {$px}px;height: {$px}px' class = 'img-circle media-object'/>n";
} else {
echo "<img src='/user/avatar/$sex' style = 'width: {$px}px;height: {$px}px' class = 'img-circle media-object'/>n";
}
}
function avatar_p($id, $px) {
global $set;
$ank = get_user($id);
if ($ank['sex'] == 0) {
$sex = 'zh.jpg';
} else {
$sex = 'm.jpg';
}
if (is_file(H . "user/avatar/$id.gif")) {
echo "<img src='/user/avatar/$id.gif' style = 'width: {$px}px;height: auto' class = 'avatar'/>n";
} elseif (is_file(H . "user/avatar/$id.jpg")) {
echo "<img src='/user/avatar/$id.jpg' style = 'width: {$px}px;height: auto' class = 'avatar'/>n";
} elseif (is_file(H . "user/avatar/$id.png")) {
echo "<img src='/user/avatar/$id.png' style = 'width: {$px}px;height: auto' class = 'avatar'/>n";
} else {
echo "<img src='/user/avatar/$sex' style = 'width: {$px}px;height: auto' class = 'avatar'/>n";
}
}
function avatar_path($id_user) {
$ava = glob(H . 'user/avatar/' . $id_user . '.*');
if ($ava) {
return str_replace(H, '/', $ava[0]);
} else {
return false;
}
}