This commit is contained in:
Julian Prieber 2023-08-23 12:09:16 +02:00
parent ad69668105
commit 6f0ca87514
1 changed files with 14 additions and 16 deletions

View File

@ -334,28 +334,26 @@ public function SendTestMail(Request $request)
if (!empty($logo)) { if (!empty($logo)) {
// Delete existing image // Delete existing image
$directory = base_path('/assets/linkstack/images/'); $path = findFile('avatar');
$files = scandir($directory); $path = base_path('/assets/linkstack/images/'.$path);
$pathinfo = "error.error";
foreach($files as $file) { // Delete existing image
if (strpos($file, "avatar".'.') !== false) { if (File::exists($path)) {
$pathinfo = "avatar". "." . pathinfo($file, PATHINFO_EXTENSION); File::delete($path);
}} }
if(file_exists(base_path('/assets/linkstack/images/').$pathinfo)){File::delete(base_path('/assets/linkstack/images/').$pathinfo);}
$logo->move(base_path('/assets/linkstack/images/'), "avatar" . '_' . time() . "." .$request->file('image')->extension()); $logo->move(base_path('/assets/linkstack/images/'), "avatar" . '_' . time() . "." .$request->file('image')->extension());
} }
if (!empty($icon)) { if (!empty($icon)) {
// 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);}
$icon->move(base_path('/assets/linkstack/images/'), "favicon" . '_' . time() . "." . $request->file('icon')->extension()); $icon->move(base_path('/assets/linkstack/images/'), "favicon" . '_' . time() . "." . $request->file('icon')->extension());
} }