Compare commits

...

4 commits

Author SHA1 Message Date
Kazhnuz
6716a8bbe7 ️ (avatar): add a way to reduce avatar size 2025-01-09 20:06:11 +01:00
Kazhnuz
db47816aeb (users): Add support for personnal page 2025-01-09 19:28:48 +01:00
Kazhnuz
f9bf460018 (users): Add support for pronouns 2025-01-09 19:20:44 +01:00
Kazhnuz
5bf9963052 (edit-user): add a way to change description 2025-01-09 19:12:50 +01:00
8 changed files with 101 additions and 2 deletions

View file

@ -95,6 +95,33 @@ echo Bootstrap::formInputHidden(array(
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name' => 'pronouns',
'label' => $L->g(string: 'Pronouns'),
'value' => $user->pronouns(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formTextarea(array(
'name' => 'description',
'label' => $L->g('Description'),
'value' => $user->description(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name' => 'homepage',
'label' => $L->g(string: 'Website'),
'value' => $user->homepage(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
?>
</div>

View file

@ -484,6 +484,35 @@ echo Bootstrap::formInputHidden(array(
'placeholder' => '',
'tip' => $L->g('Thumbnail quality in percentage')
));
echo Bootstrap::formTitle(array('title' => $L->g('Avatar')));
echo Bootstrap::formInputText(array(
'name' => 'avatarWidth',
'label' => $L->g('Width'),
'value' => $site->avatarWidth(),
'class' => '',
'placeholder' => '',
'tip' => $L->g('Avatar width in pixels')
));
echo Bootstrap::formInputText(array(
'name' => 'avatarHeight',
'label' => $L->g('Height'),
'value' => $site->avatarHeight(),
'class' => '',
'placeholder' => '',
'tip' => $L->g('Avatar height in pixels')
));
echo Bootstrap::formInputText(array(
'name' => 'avatarQuality',
'label' => $L->g('Quality'),
'value' => $site->avatarQuality(),
'class' => '',
'placeholder' => '',
'tip' => $L->g('Avatar quality in percentage')
));
?>
</div>

View file

@ -54,10 +54,14 @@ $filename = $username.'.png';
// Move from temporary directory to uploads folder
rename($_FILES['profilePictureInputFile']['tmp_name'], PATH_TMP.$tmpFilename);
$avaWidth = $site->avatarWidth() ? $site->avatarWidth() : PROFILE_IMG_WIDTH;
$avaHeight = $site->avatarHeight() ? $site->avatarWidth() : PROFILE_IMG_HEIGHT;
$avaQuality = $site->avatarQuality() ? $site->avatarWidth() : PROFILE_IMG_QUALITY;
// Resize and convert to png
$image = new Image();
$image->setImage(PATH_TMP.$tmpFilename, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop');
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, PROFILE_IMG_QUALITY, false, true);
$image->setImage(PATH_TMP.$tmpFilename, $avaWidth, $avaHeight, 'crop');
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, $avaQuality, false, true);
// Delete temporary file
Filesystem::rmfile(PATH_TMP.$tmpFilename);

View file

@ -48,6 +48,9 @@ class Site extends dbJSON
'thumbnailWidth' => 400, // px
'thumbnailHeight' => 400, // px
'thumbnailQuality' => 100,
'avatarWidth' => 400, // px
'avatarHeight' => 400, // px
'avatarQuality' => 100,
'logo' => '',
'markdownParser' => true,
'customFields' => '{}'
@ -124,6 +127,21 @@ class Site extends dbJSON
return DOMAIN_BASE . 'sitemap.xml';
}
public function avatarWidth()
{
return $this->getField('avatarWidth');
}
public function avatarHeight()
{
return $this->getField('avatarHeight');
}
public function avatarQuality()
{
return $this->getField('avatarQuality');
}
public function thumbnailWidth()
{
return $this->getField('thumbnailWidth');

View file

@ -50,6 +50,16 @@ class User
return $this->getValue('username');
}
public function pronouns()
{
return $this->getValue('pronouns');
}
public function homepage()
{
return $this->getValue('homepage');
}
public function description()
{
return $this->getValue('description');
@ -189,6 +199,7 @@ class User
$tmp['mastodon'] = $this->mastodon();
$tmp['vk'] = $this->vk();
$tmp['profilePicture'] = $this->profilePicture();
$tmp['pronouns'] = $this->pronouns();
if ($returnsArray) {
return $tmp;

View file

@ -6,7 +6,9 @@ class Users extends dbJSON {
'firstName'=>'',
'lastName'=>'',
'nickname'=>'',
'pronouns'=>'',
'description'=>'',
'homepage'=>'',
'role'=>'author', // admin, editor, author
'password'=>'',
'salt'=>'!Pink Floyd!Welcome to the machine!',

View file

@ -132,6 +132,7 @@
"username": "Username",
"first-name": "First name",
"last-name": "Last name",
"pronouns": "Pronouns",
"to-schedule-the-content-select-the-date-and-time": "To schedule the content select the date and time, the status has to be set to \"Published\".",
"email": "Email",
"role": "Role",
@ -376,6 +377,9 @@
"thumbnail-width-in-pixels": "Thumbnail width in pixels (px).",
"thumbnail-height-in-pixels": "Thumbnail height in pixels (px).",
"thumbnail-quality-in-percentage": "Thumbnail quality in percentage (%).",
"avatar-width-in-pixels": "Avatar width in pixels (px).",
"avatar-height-in-pixels": "Avatar height in pixels (px).",
"avatar-quality-in-percentage": "Avatar quality in percentage (%).",
"maximum-load-file-size-allowed:": "Maximum load file size allowed:",
"file-type-is-not-supported": "File type is not supported. Allowed types:",
"page-content": "Page content",

View file

@ -132,6 +132,7 @@
"username": "Nom dutilisateur",
"first-name": "Prénom",
"last-name": "Nom",
"pronouns": "Pronoms",
"to-schedule-the-content-select-the-date-and-time": "Pour planifier votre contenu, sélectionnez la date et lheure, le statut doit être défini sur \"Publié\".",
"email": "E-mail",
"role": "Rôle",
@ -376,6 +377,9 @@
"thumbnail-width-in-pixels": "Largeur de la miniature en pixels (px).",
"thumbnail-height-in-pixels": "Hauteur de la miniature en pixels (px).",
"thumbnail-quality-in-percentage": "Qualité des miniatures en pourcentage (%).",
"avatar-width-in-pixels": "Largeur de l'avatar en pixels (px).",
"avatar-height-in-pixels": "Hauteur de l'avatar en pixels (px).",
"avatar-quality-in-percentage": "Qualité des avatars en pourcentage (%).",
"maximum-load-file-size-allowed:": "Taille maximale des fichiers autorisée :",
"file-type-is-not-supported": "Le type de fichier nest pas supporté. Liste des extensions autorisées :",
"page-content": "Contenu de la page",