Fixed image exporting

This commit is contained in:
Julian Prieber 2024-02-06 22:26:50 +01:00
parent 6a6987fe33
commit cec01d3d02
1 changed files with 0 additions and 11 deletions

View File

@ -1097,17 +1097,6 @@ class UserController extends Controller
$userData = $user->toArray(); $userData = $user->toArray();
$userData['links'] = $links->toArray(); $userData['links'] = $links->toArray();
function findAvatar($name){
$directory = base_path('assets/img');
$files = scandir($directory);
$pathinfo = "error.error";
foreach($files as $file) {
if (strpos($file, $name.'.') !== false) {
$pathinfo = "/img/" . $name. "." . pathinfo($file, PATHINFO_EXTENSION);
}}
return $pathinfo;
}
if (file_exists(base_path(findAvatar($userId)))){ if (file_exists(base_path(findAvatar($userId)))){
$imagePath = base_path(findAvatar($userId)); $imagePath = base_path(findAvatar($userId));
$imageData = base64_encode(file_get_contents($imagePath)); $imageData = base64_encode(file_get_contents($imagePath));