Ajout de nouveaux trucs pour les users #1
5 changed files with 59 additions and 2 deletions
|
@ -484,6 +484,35 @@ echo Bootstrap::formInputHidden(array(
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
'tip' => $L->g('Thumbnail quality in percentage')
|
'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>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,14 @@ $filename = $username.'.png';
|
||||||
// Move from temporary directory to uploads folder
|
// Move from temporary directory to uploads folder
|
||||||
rename($_FILES['profilePictureInputFile']['tmp_name'], PATH_TMP.$tmpFilename);
|
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
|
// Resize and convert to png
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
$image->setImage(PATH_TMP.$tmpFilename, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop');
|
$image->setImage(PATH_TMP.$tmpFilename, $avaWidth, $avaHeight, 'crop');
|
||||||
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, PROFILE_IMG_QUALITY, false, true);
|
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, $avaQuality, false, true);
|
||||||
|
|
||||||
// Delete temporary file
|
// Delete temporary file
|
||||||
Filesystem::rmfile(PATH_TMP.$tmpFilename);
|
Filesystem::rmfile(PATH_TMP.$tmpFilename);
|
||||||
|
|
|
@ -48,6 +48,9 @@ class Site extends dbJSON
|
||||||
'thumbnailWidth' => 400, // px
|
'thumbnailWidth' => 400, // px
|
||||||
'thumbnailHeight' => 400, // px
|
'thumbnailHeight' => 400, // px
|
||||||
'thumbnailQuality' => 100,
|
'thumbnailQuality' => 100,
|
||||||
|
'avatarWidth' => 400, // px
|
||||||
|
'avatarHeight' => 400, // px
|
||||||
|
'avatarQuality' => 100,
|
||||||
'logo' => '',
|
'logo' => '',
|
||||||
'markdownParser' => true,
|
'markdownParser' => true,
|
||||||
'customFields' => '{}'
|
'customFields' => '{}'
|
||||||
|
@ -124,6 +127,21 @@ class Site extends dbJSON
|
||||||
return DOMAIN_BASE . 'sitemap.xml';
|
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()
|
public function thumbnailWidth()
|
||||||
{
|
{
|
||||||
return $this->getField('thumbnailWidth');
|
return $this->getField('thumbnailWidth');
|
||||||
|
|
|
@ -377,6 +377,9 @@
|
||||||
"thumbnail-width-in-pixels": "Thumbnail width in pixels (px).",
|
"thumbnail-width-in-pixels": "Thumbnail width in pixels (px).",
|
||||||
"thumbnail-height-in-pixels": "Thumbnail height in pixels (px).",
|
"thumbnail-height-in-pixels": "Thumbnail height in pixels (px).",
|
||||||
"thumbnail-quality-in-percentage": "Thumbnail quality in percentage (%).",
|
"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:",
|
"maximum-load-file-size-allowed:": "Maximum load file size allowed:",
|
||||||
"file-type-is-not-supported": "File type is not supported. Allowed types:",
|
"file-type-is-not-supported": "File type is not supported. Allowed types:",
|
||||||
"page-content": "Page content",
|
"page-content": "Page content",
|
||||||
|
|
|
@ -377,6 +377,9 @@
|
||||||
"thumbnail-width-in-pixels": "Largeur de la miniature en pixels (px).",
|
"thumbnail-width-in-pixels": "Largeur de la miniature en pixels (px).",
|
||||||
"thumbnail-height-in-pixels": "Hauteur 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 (%).",
|
"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 :",
|
"maximum-load-file-size-allowed:": "Taille maximale des fichiers autorisée :",
|
||||||
"file-type-is-not-supported": "Le type de fichier n’est pas supporté. Liste des extensions autorisées :",
|
"file-type-is-not-supported": "Le type de fichier n’est pas supporté. Liste des extensions autorisées :",
|
||||||
"page-content": "Contenu de la page",
|
"page-content": "Contenu de la page",
|
||||||
|
|
Loading…
Reference in a new issue