導航:首頁 > 萬維百科 > 帝國cms實現批量上傳圖片插件代碼

帝國cms實現批量上傳圖片插件代碼

發布時間:2020-10-30 21:53:33

1、帝國cms 批量修改數據

用帝國做的商城系統,上傳了很多產品圖片,後來要求把縮略圖改小,很傷腦筋,結果找到上面的帖子,但怎麼搞也不行,可能那不是針對6.0.所有自己加以修改終於成功!!!
以下為修改方法:
一、首先,在t_functions.php中添加一下兩個函數
1.function Titlepic_all ($id, $classid, $userid, $username, $pwidth, $pheight)
2. {
3. global $empire,$class_r,$class_zr,$dbtbpre,$keys;
4. $count = count ($id);
5. if (!$count)
6. {
7. printerror ('Noteditpic', 'history.go(-1)');
8. }
9. for ($i = 0; ($i < $count); ++$i)
10. {
11. $r = $empire->fetch1 ('select * from phome_ecms_'.$class_r[$classid][tbname].' where id='.$id[$i].' and titlepic<>""');
12. if(!emptyempty($r[id])){
13. ImageResize("../../".$r[titlepic],$pwidth,$pheight,"../../".$r[titlepic]);
14.
15. }
16. }
17.printerror ('TitlepicAllSuccess', $_SERVER['HTTP_REFERER']);
18. }
19.Function ImageResize($srcFile,$toW,$toH,$toFile="")
20.{
21. global $keys;
22. if($toFile==""){ $toFile = substr($srcFile,0,-4)."small".substr($srcFile,-4); }
23. $info = "";
24. $data = GetImageSize($srcFile,$info);
25. switch ($data[2])
26. {
27. case 1:
28. if(!function_exists("imagecreatefromgif")){
29. echo "你的GD庫不能使用GIF格式的圖片,請使用Jpeg或PNG格式
30.
31.!<a href='<font>javascript:</font>go(-1);'>返回</a>";
32. exit();
33. }
34. $im = ImageCreateFromGIF($srcFile);
35. break;
36. case 2:
37. if(!function_exists("imagecreatefromjpeg")){
38. Echo "你的GD庫不能使用jpeg格式的圖片,請使用其它格式的圖
39.
40.片!<a href='<font>javascript:</font>go(-1);'>返回</a>";
41. Exit();
42. }
43. $im = ImageCreateFromJpeg($srcFile);
44. break;
45. case 3:
46. $im = ImageCreateFromPNG($srcFile);
47. break;
48.}
49.$srcW = ImageSX($im);
50.$srcH = ImageSY($im);
51.$keys= 0;
52.if (($srcW>$toW) or ($srH>$toH)){
53.if(($srcW/$toW)>=($srcH/$toH)){
54. $temp_height=$toH;
55. $temp_width=$srcW/($srcH/$toH);
56. $src_X=Abs(($toW-$temp_width)/2);
57. $src_Y=0;
58. }
59. else{
60. $temp_width=$toW;
61. $temp_height=$srcH/($srcW/$toW);
62. $src_X=0;
63. $src_Y=Abs(($toH-$temp_height)/2);
64. }
65. $temp_img=ImageCreateTrueColor($temp_width,$temp_height);
66. imagecopyResampled($temp_img,$im,0,0,0,0,$temp_width,$temp_height,$srcW,$srcH);
67. $ni=ImageCreateTrueColor($toW,$toH);
68. imagecopyResampled($ni,$temp_img,0,0,$src_X,$src_Y,$toW,$toH,$toW,$toH);
69.
70.if(Function_exists('imagejpeg')) ImageJpeg($ni,$toFile);
71. else ImagePNG($ni,$toFile);
72. ImageDestroy($ni);
73.$keys= 1;
74.}
75.ImageDestroy($im);
76.}

二、修改 e/admin/ListNews.php{還有個頁面:e/admin/ListAllInfo.php},大約在最後幾行「選中全部 </td></tr>」的後面添加以下代碼:
<tr bgcolor="#FFFFFF">
<td height="25" colspan="8"><div align="right">
縮略圖寬: <input name="pwidth" type="text" value="120" width="60">
縮略圖高: <input name="pheight" type="text" value="120" width="60">
<input type="submit" name="Submit355" value="修改縮略圖" onClick="document.listform.enews.value='Titlepic_all';">
</div></td></tr>
其中,圖寬和圖稿的默認值可按自己的情況設定,設定好後,以後操作更方便。
三、在e/admin/ecmsinfo.php中添加如下代碼:
//批量加標題圖片
elseif($enews=="Titlepic_all")
{
$id=$_POST['id'];
$classid=$_POST['classid'];
$bclassid=$_POST['bclassid'];
$pwidth=$_POST['pwidth'];
$pheight=$_POST['pheight'];
Titlepic_all($id,$classid,$logininid,$loginin,$pwidth,$pheight);
}
四、函數中用到「 printerror ('Noteditpic', 'history.go(-1)');」等操作提示,這個提示可加在e/data/language/gb/pub/message.php;當然這一步不加也不影響操作
在message.php 後面加:

'Noteditpic'=>'沒有選擇!',
'TitlepicAllSuccess'=>'操作成功!',

2、帝國CMS後台如何上傳圖片?入口在哪?

把圖片新窗口打開後查看圖片的路徑,用ftp登錄後直接上傳替換就可以了

3、帝國cms 批量定時審核 代碼 或者插件 我知道帝國cms 可以設置任務自動刷新首頁和欄目

在首頁模板中加入下面代碼,盡量放在底部。
<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>

在 /e/ 建立文件夾 htmlindex 並設置 777許可權

將下面代碼保存在 /e/htmlindex/index_html.php

修改刷新時間,將文件中1200改為你想要的時間,單位為秒。

<?php
require("../class/connect.php");
include("../class/db_sql.php");
include("../class/config.php");
include("../class/functions.php");
include("../class/t_functions.php");
require LoadLang("pub/fun.php");
require("../data/dbcache/class.php");
require("../data/dbcache/MemberLevel.php");
include("../class/chtmlfun.php"); 
$link=db_connect();
$empire=new mysqlquery();
$filepath_s="indexhtmlhc.txt";
$time=time();
@$filemtime=(int)filemtime($filepath_s)+1200;
/*
函數解釋
file_exists() 函數檢查文件或目錄是否存在。
mkdir() 函數創建目錄。
time() 函數返回當前時間的 Unix 時間戳。
filemtime() 函數返迴文件內容上次的修改時間。
*/
if (!file_exists($filepath_s)){
fopen($filepath_s, 'w');
@chmod($filepath_s, 0777);
ReIndex();
}elseif(!file_exists($filepath_s) || (filemtime($filepath_s)+1200)<time()){
fopen($filepath_s, 'w');
@chmod($filepath_s, 0777);
ReIndex();
}else{
// do nothing
}
db_close();
$empire=null;
?>

4、帝國cms的編輯器怎麼修改,默認上傳的圖片a標簽調用的是圖片的連接,我想改成下一頁連接。


如上圖,圖片鏈接為下一頁,你試著勾選上試試。

當然,這里有可能的是 列表的下一頁;

如果不是內容頁分頁的下一頁,那你要實現這樣的功能的話,就得自己動手二次開發,修改帝國cms核心函數了。


如果你自己會改,那就自己開發一下;如果不會,估計你得請個人幫你 做這方面的帝國cms二次開發了。

5、插件安裝說明 將本壓縮包「upload」目錄下的所有文件上傳到帝國CMS目錄即可完成安裝。

帝國CMS目錄

即是我們通常說的根目錄
我用的是萬網的空間,用FTP進去/htdocs/文件夾既是根目錄

6、在帝國cms中,怎麼批量導入內容關鍵詞,如圖示

有解決方法的,對於這種批量導入、重復性操作等,我們現在都是用一款叫「極速點專擊虎」的軟體來完屬成。因為極速點擊虎這款軟體不需過多復雜的設置,就可自動導入填寫,自動錄入和自動點擊操作。
其實這么說吧,只要是一些重復的來回的手工操作,都可以由「極速點擊虎」軟體編排替代!實現辦公自動化輔助,批量自動運行的!

7、帝國cms怎麼批量添加信息的tags

修改步驟:
  1、以下代碼加入到admin/ecmsinfo.php,在任意2個elseif中間插入就行
elseif($enews=="AddTags_all")//列表批量添加Tags
{
$classid=$_POST['classid'];
$id=$_POST['id'];
$tags=$_POST['add_listtags'];
$newstime=time();
eInsertTags2($tags,$classid,$id,$newstime);
}
  2、將以下代碼加入到class/uesrfun.php
//加入TAG表
function eInsertTags2($tags,$classid,$id,$newstime){
global $empire,$dbtbpre,$class_r;
if(!trim($tags))
{
printerror("TAGS信息不能為空", "", 1, 0, 1);
return '';
}
$count = count($id); //統計ID數量
$tags = RepPostVar($tags);
$tag = explode(",", $tags);
if (emptyempty($count))
{
printerror("未選擇信息ID", "", 1, 0, 1);
}
if (count($tag)>1)
{
printerror("只能添加一個TAGS詞", "", 1, 0, 1);
}

$classid=(int)$classid;
$id[$i] = (int)$id[$i];
$mid=(int)$class_r[$classid][modid];
for($i=0;$i<$count;$i++)
{
$tbname=$class_r[$classid][tbname];//獲取表名
$r=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$tags' limit 1");
$t = $empire->fetch1("select infotags from {$dbtbpre}ecms_".$tbname." where id='$id[$i]'");
$taga=$t['infotags'].",".$tags; //組合TAGS
$tagb[$i] = explode(",",$taga); //設置數組
$tagc=array_values(array_unique($tagb[$i])); //數組排重
for($t=0;$t<count($tagc);$t++)
{//二級子循環TAGS數組輸出
$newtags[$i].= ",".$tagc[$t];
}
if($r[tagid])
{
$datar=$empire->fetch1("select tagid,classid,newstime from {$dbtbpre}enewstagsdata where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");
if($datar[tagid])
{
if($datar[classid]!=$classid||$datar[newstime]!=$newstime)
{
$empire->query("update {$dbtbpre}enewstagsdata set classid='$classid',newstime='$newstime' where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");
}
}
else
{
$empire->query("update {$dbtbpre}enewstags set num=num+1 where tagid='$r[tagid]'");
$empire->query("update {$dbtbpre}ecms_".$tbname." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");
$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$r[tagid]','$classid','$id[$i]','$newstime','$mid');");
}
}
else
{
$empire->query("update {$dbtbpre}ecms_".$tbname." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");
$empire->query("insert into {$dbtbpre}enewstags(tagname,num,isgood,cid) values('$tags',1,0,0);");
$tagid=$empire->lastid();
$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$tagid','$classid','$id[$i]','$newstime','$mid');");
}
}
printerror("批量添加TAGS成功", "", 1, 0, 1);
}
3、信息管理列表模板最後一列修改成以下代碼,在e/data/html/list/文件夾內
<td height="25" colspan="8">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="68%" height="25">
<font color="#666666">備註:多選框藍色為未審核信息;發布者紅色為會員投稿;信息ID粗體為未生成,點擊ID可刷新頁面.</font>
</td>
<td width="32%"> <input type="text" name="add_listtags" id="add_listtags" size="50" value="" />
<input type="submit" name="Submit100" value="添加TAGS" onClick="document.listform.enews.value='AddTags_all';document.listform.action='ecmsinfo.php';">
</td>
</tr>
</table>
</td>

8、帝國cms後台多圖上傳後有一串代碼,怎麼去掉

後台,單擊「欄目」菜單,選擇「管理評論」子菜單,進入管理評論界面

與帝國cms實現批量上傳圖片插件代碼相關的知識