略缩图怎么显示出后缀

在发布文章上传略缩图后会变成无后缀的 比如:https://www.spqhkh.com/upload_image/2022/02/04/13134299802e025063a4c2486ef45482
请问怎么让它显示后缀,或者指定格式为jpg

以下是源代码,各位看看应该修改哪里吗?

if ($_FILES["file"]["error"] !=4){
        
        function fileext($filename) 
        { 
            return substr(strrchr($filename, '.'), 1); 
        }
        
        $type=array("jpg","gif","png","jpeg");//设置允许上传文件的类型 "jpeg","png"

        if(!in_array(strtolower(fileext($_FILES['file']['name'])),$type)){
            
            alert_ini();//输出alert所需文件
            echo "<script>alert_go('上传文件类型不正确!','alert_back','','error','');</script>";
            exit;
        }
        
        if ($_FILES["file"]["size"] > 500*1024){
            alert_ini();//输出alert所需文件
            echo "<script>alert_go('上传文件大小超过限制[500K]!','alert_back','','error','');</script>";
            exit;
        }

        $filename=give_dh_18();
        
        $indate=date("Y-m-d H:i:s");
        $uppath="../upload_image/".date("Y",strtotime($indate))."/";  //目录只能逐级检查并建立
        if(!file_exists($uppath)){ 
            mkdir($uppath,0777); //新建目录
            chmod($uppath,0777); //附加权限
        }
        
        $uppath=$uppath.date("m",strtotime($indate))."/";  //目录只能逐级检查并建立
        if(!file_exists($uppath)){ 
            mkdir($uppath,0777); //新建目录
            chmod($uppath,0777); //附加权限
        }
        
        $uppath=$uppath.date("d",strtotime($indate))."/";
        if(!file_exists($uppath)){
            mkdir($uppath,0777); //新建目录
            chmod($uppath,0777); //附加权限
        }
        
        //$filePath =$uppath.$filename.".".strtolower(fileext($_FILES['file']['name']));//有后缀名
        
        $filePath =$uppath.md5($filename."image");//转为无图片后缀的名称,并加密
        
        if ($_FILES["file"]["error"] > 0){
            echo "上传参数错误: " . $_FILES["file"]["error"] . "<br />";
        }else{
            move_uploaded_file($_FILES["file"]["tmp_name"],$filePath);//上传文件,后台上传用原路径,前台过滤../
        }
    
    }else{
        alert_ini();//输出alert所需文件
        echo "<script>alert_go('请选择缩略图片!','alert_back','','error','');</script>";
        exit;
    }
    
    //超宽尺寸自动缩放 $var_article_suofang='1';//发布文章是否将内容中的图片自动缩放到指定宽度以内,1是,0if ($article_suofang=='1'){
        if(preg_match("/<img.*>/",$message)){//如果有图片
            
            include_once("../mdaima_var_inc/new_image.class.php");
            $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/"; 
            preg_match_all($pattern,stripslashes($message),$match); //count($match)  获取到的图片路径数量
            $countm=count($match[1]); //1路径,0完整含标签<img>
            //print_r($match[1]);
            //exit;
            for ($i=0;$i<=$countm-1;$i++){
                @list($ws,$tt)=@getimagesize("..".$match[1][$i]);//注意路径
                if ($ws>660 || $tt>700){  //宽度超过660或,高度超过700,才按指定的宽高比例缩放
                    $image=new image("..".$match[1][$i], 1, "660", "700" ,"..".$match[1][$i]);
                    $image->outimage();
                }
            }
            
        }
    }