Profile Picture
This commit is contained in:
parent
932ad41bfd
commit
c1cebcd185
|
@ -248,8 +248,8 @@ class HTML {
|
||||||
|
|
||||||
allcomplete: function(response) {
|
allcomplete: function(response) {
|
||||||
bar.css("width", "100%").text("100%");
|
bar.css("width", "100%").text("100%");
|
||||||
setTimeout(function() { progressbar.addClass("uk-hidden"); }, 250);
|
progressbar.addClass("uk-hidden");
|
||||||
$("#jsimageList").prepend("<option value=\'"+response.filename+"\' selected=\'selected\'>"+response.filename+"</option>");
|
$("#jsprofilePicture").attr("src", "'.HTML_PATH_UPLOADS_PROFILES.$username.'.jpg?"+new Date().getTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
notallowed: function(file, settings) {
|
notallowed: function(file, settings) {
|
||||||
|
|
|
@ -29,12 +29,19 @@ if(empty($tmpName)) {
|
||||||
$tmpName = $filename.'.'.$fileExtension;
|
$tmpName = $filename.'.'.$fileExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- PROFILE PICTURE ---
|
||||||
if($type=='profilePicture') {
|
if($type=='profilePicture') {
|
||||||
$username = Sanitize::html($_POST['username']);
|
$username = Sanitize::html($_POST['username']);
|
||||||
$tmpName = $username.'.jpg';
|
$tmpName = $username.'.jpg';
|
||||||
|
|
||||||
move_uploaded_file($source, PATH_UPLOADS_PROFILES.$tmpName);
|
move_uploaded_file($source, PATH_UPLOADS_PROFILES.$tmpName);
|
||||||
|
|
||||||
|
// Resize and crop profile image.
|
||||||
|
$Image = new Image();
|
||||||
|
$Image->setImage(PATH_UPLOADS_PROFILES.$tmpName, '200', '200', 'crop');
|
||||||
|
$Image->saveImage(PATH_UPLOADS_PROFILES.$tmpName, 100, true);
|
||||||
}
|
}
|
||||||
|
// --- OTHERS ---
|
||||||
else {
|
else {
|
||||||
move_uploaded_file($source, PATH_UPLOADS.$tmpName);
|
move_uploaded_file($source, PATH_UPLOADS.$tmpName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Image {
|
||||||
$this->resizeImage($newWidth, $newHeight, $option);
|
$this->resizeImage($newWidth, $newHeight, $option);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveImage($savePath, $imageQuality="100", $force_jpg=false)
|
public function saveImage($savePath, $imageQuality="100", $forceJPG=false)
|
||||||
{
|
{
|
||||||
$extension = strtolower(pathinfo($savePath, PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($savePath, PATHINFO_EXTENSION));
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@ class Image {
|
||||||
|
|
||||||
$path_complete = $filename.'.'.$extension;
|
$path_complete = $filename.'.'.$extension;
|
||||||
|
|
||||||
if($force_jpg)
|
if($forceJPG) {
|
||||||
{
|
|
||||||
imagejpeg($this->imageResized, $filename.'.jpg', $imageQuality);
|
imagejpeg($this->imageResized, $filename.'.jpg', $imageQuality);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -83,6 +83,11 @@ class Post extends fileContent
|
||||||
return $this->getField('username');
|
return $this->getField('username');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function profilePicture()
|
||||||
|
{
|
||||||
|
return HTML_PATH_UPLOADS_PROFILES.$this->username().'.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
public function authorFirstName()
|
public function authorFirstName()
|
||||||
{
|
{
|
||||||
return $this->getField('authorFirstName');
|
return $this->getField('authorFirstName');
|
||||||
|
|
Loading…
Reference in New Issue