Profile picture png format supported

This commit is contained in:
dignajar 2015-11-20 01:00:52 -03:00
parent 434f4acdc2
commit eed44ff34a
1 changed files with 10 additions and 6 deletions

View File

@ -33,16 +33,20 @@ if(empty($tmpName)) {
}
// --- PROFILE PICTURE ---
if($type=='profilePicture') {
$username = Sanitize::html($_POST['username']);
$tmpName = $username.'.jpg';
move_uploaded_file($source, PATH_UPLOADS_PROFILES.$tmpName);
if($type=='profilePicture')
{
// Move to tmp file
move_uploaded_file($source, PATH_UPLOADS_PROFILES.'tmp'.'.'.$fileExtension);
// Resize and crop profile image.
$username = Sanitize::html($_POST['username']);
$tmpName = $username.'.jpg';
$Image = new Image();
$Image->setImage(PATH_UPLOADS_PROFILES.$tmpName, '200', '200', 'crop');
$Image->setImage(PATH_UPLOADS_PROFILES.'tmp'.'.'.$fileExtension, '200', '200', 'crop');
$Image->saveImage(PATH_UPLOADS_PROFILES.$tmpName, 100, true);
// Remove tmp file
unlink(PATH_UPLOADS_PROFILES.'tmp'.'.'.$fileExtension);
}
// --- OTHERS ---
else {