Fix delete old photo
This commit is contained in:
parent
93583afb65
commit
1f1430fd21
@ -96,7 +96,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($msg)) {
|
if (empty($msg)) {
|
||||||
if (!empty($_FILES['photo']['name'])) {
|
if (!empty($_FILES['photo']['name']) && file_exists($_FILES['photo']['tmp_name'])) {
|
||||||
if (function_exists('imagecreatetruecolor')) {
|
if (function_exists('imagecreatetruecolor')) {
|
||||||
$hash = md5_file($_FILES['photo']['tmp_name']);
|
$hash = md5_file($_FILES['photo']['tmp_name']);
|
||||||
$subfolder = substr($hash, 0, 2);
|
$subfolder = substr($hash, 0, 2);
|
||||||
@ -129,11 +129,11 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (file_exists($imgPath)) {
|
if (file_exists($imgPath)) {
|
||||||
if ($user['photo'] != '') {
|
if ($user['photo'] != '' && strpos($user['photo'], 'default') === false) {
|
||||||
if (file_exists($UPLOAD_PATH . $d['photo'])) {
|
if (file_exists($UPLOAD_PATH . $user['photo'])) {
|
||||||
unlink($UPLOAD_PATH . $d['photo']);
|
unlink($UPLOAD_PATH . $user['photo']);
|
||||||
if (file_exists($UPLOAD_PATH . $d['photo'] . '.thumb.jpg')) {
|
if (file_exists($UPLOAD_PATH . $user['photo'] . '.thumb.jpg')) {
|
||||||
unlink($UPLOAD_PATH . $d['photo'] . '.thumb.jpg');
|
unlink($UPLOAD_PATH . $user['photo'] . '.thumb.jpg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,8 +347,8 @@ switch ($action) {
|
|||||||
->find_many();
|
->find_many();
|
||||||
if ($d) {
|
if ($d) {
|
||||||
if(isset($routes['3']) && $routes['3'] == 'deletePhoto'){
|
if(isset($routes['3']) && $routes['3'] == 'deletePhoto'){
|
||||||
if($d['photo'] != '' && $d['photo'] != '/user.default.jpg'){
|
if($d['photo'] != '' && strpos($d['photo'], 'default') === false){
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'])){
|
if(file_exists($UPLOAD_PATH.$d['photo']) && strpos($d['photo'], 'default') === false){
|
||||||
unlink($UPLOAD_PATH.$d['photo']);
|
unlink($UPLOAD_PATH.$d['photo']);
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
||||||
unlink($UPLOAD_PATH.$d['photo'].'.thumb.jpg');
|
unlink($UPLOAD_PATH.$d['photo'].'.thumb.jpg');
|
||||||
@ -628,7 +628,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
if (!empty($_FILES['photo']['name'])) {
|
if (!empty($_FILES['photo']['name']) && file_exists($_FILES['photo']['tmp_name'])) {
|
||||||
if (function_exists('imagecreatetruecolor')) {
|
if (function_exists('imagecreatetruecolor')) {
|
||||||
$hash = md5_file($_FILES['photo']['tmp_name']);
|
$hash = md5_file($_FILES['photo']['tmp_name']);
|
||||||
$subfolder = substr($hash, 0, 2);
|
$subfolder = substr($hash, 0, 2);
|
||||||
@ -661,11 +661,11 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(file_exists($imgPath)){
|
if(file_exists($imgPath)){
|
||||||
if($c['photo'] != ''){
|
if($c['photo'] != '' && strpos($c['photo'], 'default') === false){
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'])){
|
if(file_exists($UPLOAD_PATH.$c['photo'])){
|
||||||
unlink($UPLOAD_PATH.$d['photo']);
|
unlink($UPLOAD_PATH.$c['photo']);
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
if(file_exists($UPLOAD_PATH.$c['photo'].'.thumb.jpg')){
|
||||||
unlink($UPLOAD_PATH.$d['photo'].'.thumb.jpg');
|
unlink($UPLOAD_PATH.$c['photo'].'.thumb.jpg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,8 +475,8 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
if ($d) {
|
if ($d) {
|
||||||
if(isset($routes['3']) && $routes['3'] == 'deletePhoto'){
|
if(isset($routes['3']) && $routes['3'] == 'deletePhoto'){
|
||||||
if($d['photo'] != '' && $d['photo'] != '/admin.default.png'){
|
if($d['photo'] != '' && strpos($d['photo'], 'default') === false){
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'])){
|
if(file_exists($UPLOAD_PATH.$d['photo']) && strpos($d['photo'], 'default') === false){
|
||||||
unlink($UPLOAD_PATH.$d['photo']);
|
unlink($UPLOAD_PATH.$d['photo']);
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
||||||
unlink($UPLOAD_PATH.$d['photo'].'.thumb.jpg');
|
unlink($UPLOAD_PATH.$d['photo'].'.thumb.jpg');
|
||||||
@ -653,7 +653,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
run_hook('edit_admin'); #HOOK
|
run_hook('edit_admin'); #HOOK
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
if (!empty($_FILES['photo']['name'])) {
|
if (!empty($_FILES['photo']['name']) && file_exists($_FILES['photo']['tmp_name'])) {
|
||||||
if (function_exists('imagecreatetruecolor')) {
|
if (function_exists('imagecreatetruecolor')) {
|
||||||
$hash = md5_file($_FILES['photo']['tmp_name']);
|
$hash = md5_file($_FILES['photo']['tmp_name']);
|
||||||
$subfolder = substr($hash, 0, 2);
|
$subfolder = substr($hash, 0, 2);
|
||||||
@ -686,7 +686,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(file_exists($imgPath)){
|
if(file_exists($imgPath)){
|
||||||
if($d['photo'] != ''){
|
if($d['photo'] != '' && strpos($d['photo'], 'default') === false){
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'])){
|
if(file_exists($UPLOAD_PATH.$d['photo'])){
|
||||||
unlink($UPLOAD_PATH.$d['photo']);
|
unlink($UPLOAD_PATH.$d['photo']);
|
||||||
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
if(file_exists($UPLOAD_PATH.$d['photo'].'.thumb.jpg')){
|
||||||
|
@ -810,5 +810,20 @@
|
|||||||
"Package_Details": "Rincian Paket",
|
"Package_Details": "Rincian Paket",
|
||||||
"Summary": "Ringkasan",
|
"Summary": "Ringkasan",
|
||||||
"Allow_Balance_custom_amount": "Izinkan Saldo jumlah khusus",
|
"Allow_Balance_custom_amount": "Izinkan Saldo jumlah khusus",
|
||||||
"Allow_Customer_buy_balance_with_any_amount": "Izinkan Pelanggan membeli saldo dengan jumlah berapa pun"
|
"Allow_Customer_buy_balance_with_any_amount": "Izinkan Pelanggan membeli saldo dengan jumlah berapa pun",
|
||||||
|
"Or": "Atau",
|
||||||
|
"Filter": "Menyaring",
|
||||||
|
"Show_chart": "Tampilkan grafik",
|
||||||
|
"Start_Date": "Tanggal Mulai",
|
||||||
|
"Start_time": "Waktu mulai",
|
||||||
|
"End_Date": "Tanggal Akhir",
|
||||||
|
"End_Time": "Akhir Zaman",
|
||||||
|
"Internet_Plans": "Paket Internet",
|
||||||
|
"Methods": "Metode",
|
||||||
|
"Hap_Lite": "Hap Lite",
|
||||||
|
"balance": "keseimbangan",
|
||||||
|
"radius": "radius",
|
||||||
|
"Max_30_days": "Maksimal 30 hari",
|
||||||
|
"Information": "Informasi",
|
||||||
|
"Export_and_Print_will_show_all_data_without_pagination": "Ekspor dan Cetak akan menampilkan semua data tanpa pagination"
|
||||||
}
|
}
|
BIN
system/uploads/admin.default.png
Normal file
BIN
system/uploads/admin.default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -180,12 +180,12 @@ class FaceDetector
|
|||||||
*
|
*
|
||||||
* @throws NoFaceException
|
* @throws NoFaceException
|
||||||
*/
|
*/
|
||||||
public function cropFaceToJpeg($outFileName = null, $resize = false, $width = 200)
|
public function cropFaceToJpeg($outFileName = null, $width = 200)
|
||||||
{
|
{
|
||||||
if (empty($this->face)) {
|
if (empty($this->face)) {
|
||||||
throw new NoFaceException('No face detected');
|
throw new NoFaceException('No face detected');
|
||||||
}
|
}
|
||||||
if (!$resize) {
|
// if (!$resize) {
|
||||||
$x = ($a = $this->face['x'] - $this->face['w'] / 2) > 0 ? $a : 0;
|
$x = ($a = $this->face['x'] - $this->face['w'] / 2) > 0 ? $a : 0;
|
||||||
$y = ($b = $this->face['y'] - $this->face['w'] / 2) > 0 ? $b : 0;
|
$y = ($b = $this->face['y'] - $this->face['w'] / 2) > 0 ? $b : 0;
|
||||||
$im_width = imagesx($this->canvas);
|
$im_width = imagesx($this->canvas);
|
||||||
@ -193,24 +193,24 @@ class FaceDetector
|
|||||||
$w = ($w = $this->face['w'] * 2) > $im_width ? $im_width : $w;
|
$w = ($w = $this->face['w'] * 2) > $im_width ? $im_width : $w;
|
||||||
$h = ($h = $w) > $im_height ? $im_height : $h;
|
$h = ($h = $w) > $im_height ? $im_height : $h;
|
||||||
|
|
||||||
$canvas = imagecreatetruecolor($w, $h);
|
$canvas = imagecreatetruecolor($width, $width);
|
||||||
imagecopy($canvas, $this->canvas, 0, 0, $x, $y, $w, $h);
|
imagecopy($canvas, $this->canvas, 0, 0, $x, $y, $w, $h);
|
||||||
// $canvas = imagecreatetruecolor($this->face['w'], $this->face['w']);
|
// $canvas = imagecreatetruecolor($this->face['w'], $this->face['w']);
|
||||||
// imagecopy($canvas, $this->canvas, 0, 0, $this->face['x'], $this->face['y'], $this->face['w'], $this->face['w']);
|
// imagecopy($canvas, $this->canvas, 0, 0, $this->face['x'], $this->face['y'], $this->face['w'], $this->face['w']);
|
||||||
} else {
|
// } else {
|
||||||
$x = ($a = $this->face['x'] - $width / 2) > 0 ? $a : 0;
|
// $x = ($a = $this->face['x'] - $width / 2) > 0 ? $a : 0;
|
||||||
$y = ($b = $this->face['y'] - $width / 2) > 0 ? $b : 0;
|
// $y = ($b = $this->face['y'] - $width / 2) > 0 ? $b : 0;
|
||||||
$im_width = imagesx($this->canvas);
|
// $im_width = imagesx($this->canvas);
|
||||||
$im_height = imagesy($this->canvas);
|
// $im_height = imagesy($this->canvas);
|
||||||
$w = ($w = $width * 2) > $im_width ? $im_width : $w;
|
// $w = ($w = $width * 2) > $im_width ? $im_width : $w;
|
||||||
$h = ($h = $w) > $im_height ? $im_height : $h;
|
// $h = ($h = $w) > $im_height ? $im_height : $h;
|
||||||
|
|
||||||
$canvas = imagecreatetruecolor($w, $h);
|
// $canvas = imagecreatetruecolor($w, $h);
|
||||||
imagecopy($canvas, $this->canvas, 0, 0, $x, $y, $w, $h);
|
// imagecopy($canvas, $this->canvas, 0, 0, $width, $width, $w, $h);
|
||||||
|
|
||||||
// $canvas = imagecreatetruecolor($width, $width);
|
// // $canvas = imagecreatetruecolor($width, $width);
|
||||||
// imagecopyresized($canvas, $this->canvas, 0, 0, $this->face['x'], $this->face['y'], $width, $width, $this->face['w'], $this->face['w']);
|
// // imagecopyresized($canvas, $this->canvas, 0, 0, $this->face['x'], $this->face['y'], $width, $width, $this->face['w'], $this->face['w']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($outFileName === null) {
|
if ($outFileName === null) {
|
||||||
header('Content-type: image/jpeg');
|
header('Content-type: image/jpeg');
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<div class="col-md-6 col-xs-8">
|
<div class="col-md-6 col-xs-8">
|
||||||
<input type="file" class="form-control" name="photo" accept="image/*">
|
<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" title="Not always Working">
|
||||||
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<div class="col-md-6 col-xs-8">
|
<div class="col-md-6 col-xs-8">
|
||||||
<input type="file" class="form-control" name="photo" accept="image/*">
|
<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" title="Not always Working">
|
||||||
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<div class="col-md-6 col-xs-8">
|
<div class="col-md-6 col-xs-8">
|
||||||
<input type="file" class="form-control" name="photo" accept="image/*">
|
<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" title="Not always Working">
|
||||||
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
<label class=""><input type="checkbox" checked name="faceDetect" value="yes"> Facedetect</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form id="site-search" method="post" action="{$_url}customers">
|
<form id="site-search" method="post" action="{$_url}customers">
|
||||||
<input type="hidden" name="csrf_token" value="{$csrf_token}">
|
<input type="hidden" name="csrf_token" value="{$csrf_token}">
|
||||||
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
|
<div class="md-whiteframe-z1 mb20 text-center" style="padding: 15px">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -96,6 +96,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{Lang::T('Username')}</th>
|
<th>{Lang::T('Username')}</th>
|
||||||
|
<th>Photo</th>
|
||||||
<th>{Lang::T('Account Type')}</th>
|
<th>{Lang::T('Account Type')}</th>
|
||||||
<th>{Lang::T('Full Name')}</th>
|
<th>{Lang::T('Full Name')}</th>
|
||||||
<th>{Lang::T('Balance')}</th>
|
<th>{Lang::T('Balance')}</th>
|
||||||
@ -113,6 +114,11 @@
|
|||||||
<tr {if $ds['status'] != 'Active'}class="danger" {/if}>
|
<tr {if $ds['status'] != 'Active'}class="danger" {/if}>
|
||||||
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
|
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
|
||||||
style="cursor:pointer;">{$ds['username']}</td>
|
style="cursor:pointer;">{$ds['username']}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{$UPLOAD_PATH}{$ds['photo']}" target="photo">
|
||||||
|
<img src="{$UPLOAD_PATH}{$ds['photo']}.thumb.jpg" width="32" alt="">
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td>{$ds['account_type']}</td>
|
<td>{$ds['account_type']}</td>
|
||||||
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
|
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
|
||||||
style="cursor: pointer;">{$ds['fullname']}</td>
|
style="cursor: pointer;">{$ds['fullname']}</td>
|
||||||
@ -120,8 +126,7 @@
|
|||||||
<td align="center">
|
<td align="center">
|
||||||
{if $ds['phonenumber']}
|
{if $ds['phonenumber']}
|
||||||
<a href="tel:{$ds['phonenumber']}" class="btn btn-default btn-xs"
|
<a href="tel:{$ds['phonenumber']}" class="btn btn-default btn-xs"
|
||||||
title="{$ds['phonenumber']}"><i
|
title="{$ds['phonenumber']}"><i class="glyphicon glyphicon-earphone"></i></a>
|
||||||
class="glyphicon glyphicon-earphone"></i></a>
|
|
||||||
{/if}
|
{/if}
|
||||||
{if $ds['email']}
|
{if $ds['email']}
|
||||||
<a href="mailto:{$ds['email']}" class="btn btn-default btn-xs"
|
<a href="mailto:{$ds['email']}" class="btn btn-default btn-xs"
|
||||||
@ -139,7 +144,7 @@
|
|||||||
<td>{$ds['service_type']}</td>
|
<td>{$ds['service_type']}</td>
|
||||||
<td>
|
<td>
|
||||||
{$ds['pppoe_username']}
|
{$ds['pppoe_username']}
|
||||||
{if !empty($ds['pppoe_username']) && !empty($ds['pppoe_ip'])}:{/if}
|
{if !empty($ds['pppoe_username']) && !empty($ds['pppoe_ip'])}:{/if}
|
||||||
{$ds['pppoe_ip']}
|
{$ds['pppoe_ip']}
|
||||||
</td>
|
</td>
|
||||||
<td>{Lang::T($ds['status'])}</td>
|
<td>{Lang::T($ds['status'])}</td>
|
||||||
@ -154,8 +159,8 @@
|
|||||||
<a href="{$_url}customers/sync/{$ds['id']}&token={$csrf_token}" id="{$ds['id']}"
|
<a href="{$_url}customers/sync/{$ds['id']}&token={$csrf_token}" id="{$ds['id']}"
|
||||||
style="margin: 5px; color:black"
|
style="margin: 5px; color:black"
|
||||||
class="btn btn-success btn-xs"> {Lang::T('Sync')} </a>
|
class="btn btn-success btn-xs"> {Lang::T('Sync')} </a>
|
||||||
<a href="{$_url}plan/recharge/{$ds['id']}&token={$csrf_token}" id="{$ds['id']}" style="margin: 0px;"
|
<a href="{$_url}plan/recharge/{$ds['id']}&token={$csrf_token}" id="{$ds['id']}"
|
||||||
class="btn btn-primary btn-xs">{Lang::T('Recharge')}</a>
|
style="margin: 0px;" class="btn btn-primary btn-xs">{Lang::T('Recharge')}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user