搜外网>搜外问答>问答页面

发布文章时上传的略缩图为什么不显示后缀? 悬赏1元 已结束

<p>比如:<a id="textarea_1644130984161_1644131099299_0" href="https://www.spqhkh.com/upload_image/2022/02/04/13134299802e025063a4c2486ef45482" target="_blank" data-url="www.spqhkh.com" class="show-5118-data" rel="nofollow"><span class="md_link_url">https://www.spqhkh.com/upload_image/2022/02/04/13134299802e025063a4c2486ef45482</span></a><br>大家可以看到,没有后缀,请问怎么显示出来,或者定为jpg 后缀</p><p>以下是代码,请问怎么修改啊</p><p><?<br>include_once("../mdaima_var_inc/config_system.php");//必须先调用获取基本参数 <br>include_once("../mdaima_var_inc/config_system_info.php");//必须先调用获取基本参数<br>include_once("../mdaima_var_inc/checkall.php"); <br>include_once("../mdaima_var_inc/conn.php"); <br> <br>$url_info = geturl($_SERVER[QUERY_STRING],$key_url_md_5);<br>//--------------搜索条件生成<br>include_once("news_post_all.php"); <br>//--------------搜索条件生成<br>$action=$url_info['action'];<br>$time=$url_info['time'];<br> <br>//修改用户-开始<br> <br>if ($action=="add"){<br> <br>    $title=quotes_gpc_pd($_POST['title'],1);<br>    $laiyuan=quotes_gpc_pd($_POST['laiyuan'],1);<br>    $message=quotes_gpc_pd($_POST['message1'],0);<br>    $indate=quotes_gpc_pd($_POST['indate'],1);<br>    $pass=quotes_gpc_pd($_POST['pass'],1);<br>    $hits=quotes_gpc_pd($_POST['hits'],1);<br>    $zhiding=quotes_gpc_pd($_POST['zhiding'],1);<br>    $pinglun=quotes_gpc_pd($_POST['pinglun'],1);<br>    $guanjianci=quotes_gpc_pd($_POST['guanjianci'],1);<br>    <br>    $article_suofang=quotes_gpc_pd($_POST['article_suofang'],1);<br>    $article_shuiyin=quotes_gpc_pd($_POST['article_shuiyin'],1);<br> <br>    if ($title=="" ){<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('文章标题必须填写!','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    if ($guanjianci==""){<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('关键词,必须填写!','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    if ($message=="" ){<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('文章内容必须填写','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    if ($laiyuan=="" ){<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('文章来源必须填写','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    if ($hits=="" ){<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('文章访问次数必须填写','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    if ($indate==""){<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('文章日期,必须填写!','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    if ($_FILES["file"]["error"] !=4){<br>        <br>        function fileext($filename) <br>        { <br>            return substr(strrchr($filename, '.'), 1); <br>        }<br>        <br>        $type=array("jpg","gif","png","jpeg");//设置允许上传文件的类型 "jpeg","png"<br> <br>        if(!in_array(strtolower(fileext($_FILES['file']['name'])),$type)){<br>            <br>            alert_ini();//输出alert所需文件<br>            echo "<script>alert_go('上传文件类型不正确!','alert_back','','error','');</script>";<br>            exit;<br>        }<br>        <br>        if ($_FILES["file"]["size"] > 5001024){<br>            alert_ini();//输出alert所需文件<br>            echo "<script>alert_go('上传文件大小超过限制[500K]!','alert_back','','error','');</script>";<br>            exit;<br>        }<br> <br>        $filename=give_dh_18();<br>        <br>        $indate=date("Y-m-d H:i:s");<br>        $uppath="../upload_image/".date("Y",strtotime($indate))."/";  //目录只能逐级检查并建立<br>        if(!file_exists($uppath)){ <br>            mkdir($uppath,0777); //新建目录<br>            chmod($uppath,0777); //附加权限<br>        }<br>        <br>        $uppath=$uppath.date("m",strtotime($indate))."/";  //目录只能逐级检查并建立<br>        if(!file_exists($uppath)){ <br>            mkdir($uppath,0777); //新建目录<br>            chmod($uppath,0777); //附加权限<br>        }<br>        <br>        $uppath=$uppath.date("d",strtotime($indate))."/";<br>        if(!file_exists($uppath)){<br>            mkdir($uppath,0777); //新建目录<br>            chmod($uppath,0777); //附加权限<br>        }<br>        <br>        //$filePath =$uppath.$filename.".".strtolower(fileext($_FILES['file']['name']));//有后缀名<br>        <br>        $filePath =$uppath.md5($filename."image");//转为无图片后缀的名称,并加密<br>        <br>        if ($_FILES["file"]["error"] > 0){<br>            echo "上传参数错误: " . $_FILES["file"]["error"] . "<br />";<br>        }else{<br>            move_uploaded_file($_FILES["file"]["tmp_name"],$filePath);//上传文件,后台上传用原路径,前台过滤../<br>        }<br>    <br>    }else{<br>        alert_ini();//输出alert所需文件<br>        echo "<script>alert_go('请选择缩略图片!','alert_back','','error','');</script>";<br>        exit;<br>    }<br>    <br>    //超宽尺寸自动缩放 $var_article_suofang='1';//发布文章是否将内容中的图片自动缩放到指定宽度以内,1是,0否<br>    if ($article_suofang=='1'){<br>        if(preg_match("//",$message)){//如果有图片<br>            <br>            include_once("../mdaima_var_inc/new_image.class.php");<br>            $pattern="/<[img|IMG].?src=\'|\"[\'|\"].?[\/]?>/"; <br>            preg_match_all($pattern,stripslashes($message),$match); //count($match)  获取到的图片路径数量<br>            $countm=count($match[1]); //1路径,0完整含标签<img><br>            //print_r($match[1]);<br>            //exit;<br>            for ($i=0;$i<=$countm-1;$i++){<br>                @list($ws,$tt)=@getimagesize("..".$match[1][$i]);//注意路径<br>                if ($ws>660 || $tt>700){  //宽度超过660或,高度超过700,才按指定的宽高比例缩放<br>                    $image=new image("..".$match[1][$i], 1, "660", "700" ,"..".$match[1][$i]);<br>                    $image->outimage();<br>                }<br>            }<br>            <br>        }<br>    }<br>    <br> <br>    //水印,图片处理完最后执行 $var_article_shuiyin='1';//发布文章是否将内容中的图片自动添加水印,1是,0否<br>    if ($article_shuiyin=='1'){<br>        if(preg_match("//",$message)){//如果有图片<br>            <br>            include_once("../mdaima_var_inc/new_image.class.php");<br>            $pattern="/<[img|IMG].?src=\'|\"[\'|\"].?[\/]?>/"; <br>            preg_match_all($pattern,stripslashes($message),$match); //count($match)  获取到的图片路径数量<br>            $countm=count($match[1]); //1路径,0完整含标签<img><br>            <br>            for ($i=0;$i<=$countm-1;$i++){<br>                @list($ws,$tt)=@getimagesize("..".$match[1][$i]);<br>                if ($ws>300 && $tt>50){  //宽度超过350且,高度超过250,才添加水印<br>                    $image=new image("..".$match[1][$i], 3, "../images/shuiyin.gif", "9","..".$match[1][$i]);<br>                    $image->outimage();<br>                }<br>            }<br>            <br>        }<br>    }<br> <br>    $title_code = quweima($title);//将标题转为数字区位索引<br>    <br>    $sql="insert into lei_news (title,title_code,message,indate,laiyuan,hits,pass,simgpaths,zhiding,huifuzt,guanjianci,pinglun) values ('".$title."','".$title_code."','".$message."','".$indate."','".$laiyuan."',".$hits.",'".$pass."','".$filePath."','".$zhiding."','0','".$guanjianci."','".$pinglun."') ";<br>    $mysqli->query($sql);<br> <br>    $result_zidian=$mysqli->query("select last_insert_id()");//mysql_insert_id($mysqli);//获取自动增键<br>    if($mysqllast=$result_zidian->fetch_assoc()){<br>        $aid=$mysqllast["last_insert_id()"];//关联ID<br>    }<br>    <br>    $back_url=encrypt_url("&page=".$page."&aid=".$aid."&".$pageurl."&time=".time(),$key_url_md_5);<br>    <br>    alert_ini();//输出alert所需文件<br>    echo "<script>alert_go('文章添加成功!','alert_go','','ok','news_list.php?".$back_url."');</script>";<br>    exit;<br>    <br>    $mysqli->close();<br> <br>}<br>//结束<br> <br>?><br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" data-url="www.w3.org" class="show-5118-data" rel="nofollow" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"><br><html xmlns="<a href="http://www.w3.org/1999/xhtml" data-url="www.w3.org" class="show-5118-data" rel="nofollow" target="_blank">http://www.w3.org/1999/xhtml</a>"><br><head><br><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br><link href="css/admin_style.css" rel="stylesheet" type="text/css" /><br><script type="text/javascript" charset="gbk" src="js/tooledit/ueditor_baidu/ueditor_1.config.js"></script><br><script type="text/javascript" charset="gbk" src="js/tooledit/ueditor_baidu/ueditor.all.min.js"> </script><br><script type="text/javascript" charset="gbk" src="js/tooledit/ueditor_baidu/lang/zh-cn/zh-cn.js"></script><br><script type="text/javascript" charset="gbk" src="js/jquery.min.js"></script><br><link href="css/bootstrap_modal.min.css" rel="stylesheet" media="screen"><br> <br><script src="js/bootstrap.min.js"></script><br><script language="javascript" type="text/javascript" src="js/my97datepicker/WdatePicker.js"></script><br> <br></head><br> <br><body><br><? include_once("js/js_alert.php"); //调用MODULE弹出框?><br><div class="wrap">    <br> <br>    <div class="h_a">功能说明</div><br>    <div class="prompt_text"><br>        <ol><br>            <li>文章状态分为“未发布”和“发布”,“未发布”状态下的文章前台不显示。</li><br>        </ol><br>    </div><br> <br>    <form name="formsa" id="formsa" method="POST" enctype="multipart/form-data" action="?<?=encrypt_url("&page=".$page."&".$pageurl."&action=add&time=".time(),$key_url_md_5)?>"><!--//加密链变量 --><br>    <div class="h_a">添加期货资讯信息</div><br>    <div class="table_full"><br>        <table width="100%" ><br>            <colgroup><br>                    <col class="th" ><br>                    <col ><br>            </colgroup><br>            <tr><br>              <th>文章标题</th><br>              <td><br>              <input name="title" type="text" id="title" value="" class="input length_5" /></td><br>          </tr><br>          <br>           <tr><br>              <th>关键词</th><br>              <td><input name="guanjianci" type="text" class="input length_5" id="guanjianci" value="" maxlength="30" /><br>              &nbsp; 多个关键词,以半角逗号(,)分开(SEO关键词设置)</td><br>          </tr><br>            <br>          <tr><br>              <th>文章来源</th><br>              <td><br>              <input name="laiyuan" type="text" id="laiyuan" value="" class="input length_5" />&nbsp;&nbsp;<select id="zhuanye_as" name="zhuanye_as" onChange="document.getElementById('laiyuan').value=this.options[this.selectedIndex].value" ><br>                <option value="">---选择来源---</option><br>                <option value="本站原创">本站原创</option><br>                <option value="本站整理">本站整理</option><br>                <option value="互联网转载">互联网转载</option><br>                </select></td><br>          </tr><br>           <tr><br>              <th>访问次数</th><br>              <td><br>              <input name="hits" type="text" id="hits" value="0" class="input length_5" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" onafterpaste="this.value=this.value.replace(/[^\d.]/g,'')"/></td><br>          </tr><br>          <tr><br>              <th>缩略图片</th><br>              <td><input name="file" type="file" id="file" class="input length_5"/>&nbsp; 180130</td><br>          </tr><br>            <tr><br>              <th>文章状态</th><br>              <td><select name="pass" class="select_5" id="pass"><br>                        <option value="0" selected >未发布</option><br>                        <option value="1" >发布</option><br>                    </select></td><br>          </tr><br>          <tr><br>              <th>是否置顶</th><br>              <td><br>                <input type="radio" name="zhiding" value="0" checked="checked" /> 不置顶&nbsp;&nbsp;<br>                <input type="radio" name="zhiding" value="1"  /> 置顶<br>              </td><br>          </tr><br>          <tr><br>              <th>是否评论</th><br>              <td><br>                <input type="radio" name="pinglun" value="0" checked="checked" />不可以<br>                <input type="radio" name="pinglun" value="1" /> 可以&nbsp;&nbsp;              </td><br>          </tr><br>          <tr><br>              <th>图片属性</th><br>              <td><br>                <input name="article_suofang" type="checkbox" value="1" /><br>              自动缩放文章图片 &nbsp;&nbsp;&nbsp;&nbsp;             <br>              <input name="article_shuiyin" type="checkbox" value="1" /><br>为文章图片添加水印</td><br>          </tr><br>            <tr><br>              <th>发布日期</th><br>              <td><br>              <input name="indate" type="text" id="indate" value="<?=date("Y-m-d H:i:s")?>" onFocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="true" class="input length_5" /></td><br>          </tr><br>            <br> <br>            <tr><br>              <th>文章内容</th><br>              <td><script id="editor1" name="message1" type="text/plain" style="width:99%;height:150px;"></script></td><br>          </tr><br>        </table><br>    </div><br>    <br>    <div class="btn_wrap2"><br>        <div class="btn_wrap_pd2"><br>            <br>            <button class="btn btn_big btn_submit" type="button" onClick="alert_go('确认保存文章?','submit','formsa','wen','')" >保存文章</button><br>            &nbsp;<br>            <?<br>            $back_url=encrypt_url("&page=".$page."&".$pageurl."&time=".time(),$key_url_md_5);<br>            ?><br>            <button class="btn btn_big loading_it" type="button" onClick="document.location.href='news_list.php?<?=$back_url?>';" > 返回列表 </button><br>            <br>            <br>        </div><br>    </div><br> <br>    </form><br></div><br> <br><script type="text/javascript"><br>    var ue1 = UE.getEditor('editor1');<br></script><br></body><br></html><br> <br> <br><br></p>

追加问题
    14 人参与回答
最佳回答
推推蛙
推推蛙 · 擅长SEOSEM爱采购诊断、方案编写、优化运维。微信:tuituiwaseo

1、我看你有的网址里的配图,是有带jpg的,即使没带jpg的,保存的时候也是图片;

2、可尝试重新上传,看看是否正常,如果是系统的问题,你的图片应该不会有的正常,有的不正常。

ps:随机看了几个文章里的图片,大都是正常没有问题,后缀也是jpg

只要能用就可以了

只要能用就可以

晓迪
晓迪 · 鲜丰水果加盟

牛逼了 学到了

瑶瑶超开心
瑶瑶超开心 · 苹果企业签名 ios签名 企业签名

这个真的是太厉害了

柠檬树上
柠檬树上 · 重庆不孕不育医院相关的不孕治疗及诊疗服务

后缀不是自动自己生成的吗

小黄鸭呀?
小黄鸭呀? · 苹果签名、企业签名、苹果企业签名

进来学习一下看看大佬的回复

十六夜
十六夜 · 气象站-气象监测传感器-农业观测站设备-全自动气象站

代码的问题可以换CNDS上面问问

素材网
素材网 · 素材网,网站模板,网站素材,视频教程,sucaipro。com

网站总体权重流量低,肯定排名

就我自己没看懂么

已经搞好了,这里也没答案。

这个真的是太厉害了

这个太难了会的都老厉害了