This commit is contained in:
Julian Prieber 2023-08-23 12:06:35 +02:00
parent 0e21d30fc6
commit ad69668105
1 changed files with 13 additions and 16 deletions

View File

@ -365,15 +365,13 @@ public function SendTestMail(Request $request)
//Delete avatar //Delete avatar
public function delAvatar() public function delAvatar()
{ {
$path = findFile('avatar');
$path = base_path('/assets/linkstack/images/'.$path);
// Delete existing image // Delete existing image
$directory = base_path('/assets/linkstack/images/'); if (File::exists($path)) {
$files = scandir($directory); File::delete($path);
$pathinfo = "error.error"; }
foreach($files as $file) {
if (strpos($file, "avatar".'.') !== false) {
$pathinfo = "avatar". "." . pathinfo($file, PATHINFO_EXTENSION);
}}
if(file_exists(base_path('/assets/linkstack/images/').$pathinfo)){File::delete(base_path('/assets/linkstack/images/').$pathinfo);}
return back(); return back();
} }
@ -382,14 +380,13 @@ public function SendTestMail(Request $request)
public function delFavicon() public function delFavicon()
{ {
// Delete existing image // Delete existing image
$directory = base_path('/assets/linkstack/images/'); $path = findFile('favicon');
$files = scandir($directory); $path = base_path('/assets/linkstack/images/'.$path);
$pathinfo = "error.error";
foreach($files as $file) { // Delete existing image
if (strpos($file, "favicon".'.') !== false) { if (File::exists($path)) {
$pathinfo = "favicon". "." . pathinfo($file, PATHINFO_EXTENSION); File::delete($path);
}} }
if(file_exists(base_path('/assets/linkstack/images/').$pathinfo)){File::delete(base_path('/assets/linkstack/images/').$pathinfo);}
return back(); return back();
} }