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