I have an employee folder in the public directory. A picture can be uploaded there with different extensions. The extension can be either small or capital letters.
example : A user can upload a file such as listed below:
12345.JPG Or 12345.jpg Or 12345.PNG Or 12345.png
When I am going to show/view this uploaded image file according to an employee number, first I need to know the uploaded file's correct extension from the public directory.
I have tried to show using below one only for one extension but not for all.
<img class="profile-user-img img-fluid img-circle"
src="{{ (file_exists(public_path('/hrm/employee/'.$employee->employee_no.'.JPG'))) ? asset('/hrm/employee/'.$employee->employee_no.'.JPG') : asset('/hrm/employee/'.$employee->employee_no.'.jpg') }}"
alt="User profile picture">
Can someone please tell me how can I show the image name from the directory without knowing the uploaded file's extension for a specific employee number?