Customer Photo
This commit is contained in:
parent
6e446192d8
commit
3dfb12d830
@ -95,19 +95,72 @@ switch ($action) {
|
|||||||
$msg .= 'Phone Number must be a number' . '<br>';
|
$msg .= 'Phone Number must be a number' . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->fullname = $fullname;
|
if (empty($msg)) {
|
||||||
$user->address = $address;
|
if (!empty($_FILES['photo']['name'])) {
|
||||||
if ($_c['allow_phone_otp'] != 'yes') {
|
if (function_exists('imagecreatetruecolor')) {
|
||||||
$user->phonenumber = $phonenumber;
|
$hash = md5_file($_FILES['photo']['tmp_name']);
|
||||||
}
|
$subfolder = substr($hash, 0, 2);
|
||||||
if ($_c['allow_email_otp'] != 'yes') {
|
$folder = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
|
||||||
$user->email = $email;
|
if (!file_exists($folder)) {
|
||||||
}
|
mkdir($folder);
|
||||||
|
}
|
||||||
|
$folder = $UPLOAD_PATH . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR . $subfolder . DIRECTORY_SEPARATOR;
|
||||||
|
if (!file_exists($folder)) {
|
||||||
|
mkdir($folder);
|
||||||
|
}
|
||||||
|
$imgPath = $folder . $hash . '.jpg';
|
||||||
|
if (!file_exists($imgPath)) {
|
||||||
|
File::resizeCropImage($_FILES['photo']['tmp_name'], $imgPath, 1600, 1600, 100);
|
||||||
|
}
|
||||||
|
if (!file_exists($imgPath . '.thumb.jpg')) {
|
||||||
|
if (_post('faceDetect') == 'yes') {
|
||||||
|
try {
|
||||||
|
$detector = new svay\FaceDetector();
|
||||||
|
$detector->setTimeout(5000);
|
||||||
|
$detector->faceDetect($imgPath);
|
||||||
|
$detector->cropFaceToJpeg($imgPath . '.thumb.jpg', false);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
File::makeThumb($imgPath, $imgPath . '.thumb.jpg', 200);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
File::makeThumb($imgPath, $imgPath . '.thumb.jpg', 200);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
File::makeThumb($imgPath, $imgPath . '.thumb.jpg', 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file_exists($imgPath)) {
|
||||||
|
if ($user['photo'] != '') {
|
||||||
|
if (file_exists($UPLOAD_PATH . $d['photo'])) {
|
||||||
|
unlink($UPLOAD_PATH . $d['photo']);
|
||||||
|
if (file_exists($UPLOAD_PATH . $d['photo'] . '.thumb.jpg')) {
|
||||||
|
unlink($UPLOAD_PATH . $d['photo'] . '.thumb.jpg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user->photo = '/photos/' . $subfolder . '/' . $hash . '.jpg';
|
||||||
|
}
|
||||||
|
if (file_exists($_FILES['photo']['tmp_name'])) unlink($_FILES['photo']['tmp_name']);
|
||||||
|
} else {
|
||||||
|
r2(U . 'settings/app', 'e', 'PHP GD is not installed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$user->save();
|
$user->fullname = $fullname;
|
||||||
|
$user->address = $address;
|
||||||
|
if ($_c['allow_phone_otp'] != 'yes') {
|
||||||
|
$user->phonenumber = $phonenumber;
|
||||||
|
}
|
||||||
|
if ($_c['allow_email_otp'] != 'yes') {
|
||||||
|
$user->email = $email;
|
||||||
|
}
|
||||||
|
|
||||||
_log('[' . $user['username'] . ']: ' . Lang::T('User Updated Successfully'), 'User', $user['id']);
|
$user->save();
|
||||||
r2(U . 'accounts/profile', 's', Lang::T('User Updated Successfully'));
|
|
||||||
|
_log('[' . $user['username'] . ']: ' . Lang::T('User Updated Successfully'), 'User', $user['id']);
|
||||||
|
r2(U . 'accounts/profile', 's', Lang::T('User Updated Successfully'));
|
||||||
|
}else{
|
||||||
|
r2(U . 'accounts/profile', 'e', $msg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -776,5 +776,7 @@
|
|||||||
"When_Expired__customer_will_be_move_to_selected_internet_package": "Jika masa berlaku habis, pelanggan akan dipindahkan ke paket internet yang dipilih",
|
"When_Expired__customer_will_be_move_to_selected_internet_package": "Jika masa berlaku habis, pelanggan akan dipindahkan ke paket internet yang dipilih",
|
||||||
"Data_Change": "Perubahan Data",
|
"Data_Change": "Perubahan Data",
|
||||||
"Home_Address": "Alamat Rumah",
|
"Home_Address": "Alamat Rumah",
|
||||||
"Email_Address": "Alamat Email"
|
"Email_Address": "Alamat Email",
|
||||||
|
"Custom_Balance": "Saldo Kustom",
|
||||||
|
"Input_Desired_Amount": "Masukkan Jumlah yang Diinginkan"
|
||||||
}
|
}
|
@ -19,7 +19,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 col-xs-12 control-label">{Lang::T('Photo')}</label>
|
<label class="col-md-3 col-xs-12 control-label">{Lang::T('Photo')}</label>
|
||||||
<div class="col-md-6 col-xs-8">
|
<div class="col-md-6 col-xs-8">
|
||||||
<input type="file" class="form-control" name="photo">
|
<input type="file" class="form-control" name="photo" accept="image/*">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3 col-xs-4">
|
<div class="form-group col-md-3 col-xs-4">
|
||||||
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
||||||
|
@ -2,16 +2,30 @@
|
|||||||
<!-- user-profile -->
|
<!-- user-profile -->
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-12">
|
<div class="col-md-6 col-md-offset-3">
|
||||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||||
<div class="panel-heading">{Lang::T('Data Change')}</div>
|
<div class="panel-heading">{Lang::T('Data Change')}</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form class="form-horizontal" method="post" role="form" action="{$_url}accounts/edit-profile-post">
|
<form class="form-horizontal" enctype="multipart/form-data" method="post" role="form" action="{$_url}accounts/edit-profile-post">
|
||||||
<input type="hidden" name="csrf_token" value="{$csrf_token}">
|
<input type="hidden" name="csrf_token" value="{$csrf_token}">
|
||||||
<input type="hidden" name="id" value="{$_user['id']}">
|
<input type="hidden" name="id" value="{$_user['id']}">
|
||||||
|
<center>
|
||||||
|
<img src="{$UPLOAD_PATH}{$_user['photo']}.thumb.jpg" width="200"
|
||||||
|
onerror="this.src='{$UPLOAD_PATH}/user.default.jpg'" class="img-circle img-responsive"
|
||||||
|
alt="Foto" onclick="return deletePhoto({$d['id']})">
|
||||||
|
</center><br>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Username')}</label>
|
<label class="col-md-3 col-xs-12 control-label">{Lang::T('Photo')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6 col-xs-8">
|
||||||
|
<input type="file" class="form-control" name="photo" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3 col-xs-4">
|
||||||
|
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-3 control-label">{Lang::T('Username')}</label>
|
||||||
|
<div class="col-md-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
{if $_c['registration_username'] == 'phone'}
|
{if $_c['registration_username'] == 'phone'}
|
||||||
<span class="input-group-addon" id="basic-addon1"><i
|
<span class="input-group-addon" id="basic-addon1"><i
|
||||||
@ -30,23 +44,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Full Name')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Full Name')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-9">
|
||||||
<input type="text" class="form-control" id="fullname" name="fullname"
|
<input type="text" class="form-control" id="fullname" name="fullname"
|
||||||
value="{$_user['fullname']}">
|
value="{$_user['fullname']}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Home Address')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Home Address')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-9">
|
||||||
<textarea name="address" id="address" class="form-control">{$_user['address']}</textarea>
|
<textarea name="address" id="address" class="form-control">{$_user['address']}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{if $_c['allow_phone_otp'] != 'yes'}
|
{if $_c['allow_phone_otp'] != 'yes'}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Phone Number')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Phone Number')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon" id="basic-addon1"><i class="glyphicon glyphicon-phone-alt"></i></span>
|
<span class="input-group-addon" id="basic-addon1"><i class="glyphicon glyphicon-phone-alt"></i></span>
|
||||||
<input type="text" class="form-control" name="phonenumber" id="phonenumber"
|
<input type="text" class="form-control" name="phonenumber" id="phonenumber"
|
||||||
@ -57,8 +71,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{else}
|
{else}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Phone Number')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Phone Number')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon" id="basic-addon1"><i class="glyphicon glyphicon-phone-alt"></i></span>
|
<span class="input-group-addon" id="basic-addon1"><i class="glyphicon glyphicon-phone-alt"></i></span>
|
||||||
<input type="text" class="form-control" name="phonenumber" id="phonenumber"
|
<input type="text" class="form-control" name="phonenumber" id="phonenumber"
|
||||||
@ -74,15 +88,15 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{if $_c['allow_email_otp'] != 'yes'}
|
{if $_c['allow_email_otp'] != 'yes'}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Email Address')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Email Address')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-9">
|
||||||
<input type="text" class="form-control" id="email" name="email" value="{$_user['email']}">
|
<input type="text" class="form-control" id="email" name="email" value="{$_user['email']}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{else}
|
{else}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Email Address')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Email Address')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-9">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
|
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
|
||||||
<input type="text" class="form-control" name="email" id="email"
|
<input type="text" class="form-control" name="email" id="email"
|
||||||
@ -96,10 +110,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-lg-offset-2 col-lg-10">
|
<div class="col-md-offset-3 col-md-9">
|
||||||
<button class="btn btn-success" type="submit">
|
<button class="btn btn-success btn-block" type="submit">
|
||||||
{Lang::T('Save Changes')}</button>
|
{Lang::T('Save Changes')}</button>
|
||||||
Or <a href="{$_url}home">{Lang::T('Cancel')}</a>
|
<br>
|
||||||
|
<a href="{$_url}home" class="btn btn-link btn-block">{Lang::T('Cancel')}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 col-xs-12 control-label">{Lang::T('Photo')}</label>
|
<label class="col-md-3 col-xs-12 control-label">{Lang::T('Photo')}</label>
|
||||||
<div class="col-md-6 col-xs-8">
|
<div class="col-md-6 col-xs-8">
|
||||||
<input type="file" class="form-control" name="photo">
|
<input type="file" class="form-control" name="photo" accept="image/*">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3 col-xs-4">
|
<div class="form-group col-md-3 col-xs-4">
|
||||||
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2024.10.23"
|
"version": "2024.10.31"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user