I have a simple upload image function where user gets to choose what image to be uploaded for the profile pic. The image function allows every type of image. Once the user uploads the image file, it will save in a directory specified by me in the public folder where the name will change to something like this.
if the userId = 32
then the image will be stored as 32.ext
where "ext" is the image's extension.
My question is when retrieving the image when the user finished uploading and goes to the profile page. I can only do one type of filetype say jpg not png or any extension.
<img src="<?php echo "/public/images/event/".$userDetails->id.".jpg";?>" />
My question is how to check for extension and depending upon the extension it will show up like that itself. Say the user uploaded a png file, the output will be 32.png , but right now I am hardcoding the file extension to be jpg.