打开/dede/inc/inc_batchup.php文件
找到
//删除数据库的内容
在它上面加入
//删除缩略图
if($arcRow['litpic']!=""){
$dsql->ExecuteNoneQuery("Delete From dede_uploads where url='$arcRow[litpic]'");
$truedir = GetTruePath($arcRow['siterefer'],$arcRow['sitepath']);
$litpicfile = $truedir.$arcRow['litpic'];
@unlink($litpicfile);
}
//删除大图
$arcbodyQuery = "Select * from ".$arcRow['addtable']." where aid='$aid'";
$arcbodyRow = $dsql->GetOne($arcbodyQuery);
$imgsrcarray=GetImageSrc($arcbodyRow['body']);
foreach ($imgsrcarray as $v) {
if((trim($v)!="")&&(!eregi("^http://",$v))){
$dsql->ExecuteNoneQuery("Delete From dede_uploads where url='$v'");
$picfile = $truedir.$v;
@unlink($picfile);
}
}
再找到
Select dede_archives.ID,dede_archives.title,dede_archives.typeid
改为
Select dede_archives.ID,dede_archives.title,dede_archives.typeid,dede_archives.litpic
然后再在文件最后加上一函数
//获得内容中的图像地址
function GetImageSrc($body){
if( !isset($body)) return '';
else{
preg_match_all ("/<(img|IMG)(.*)(src|SRC)=[\"|'|]{0,}([h|\/].*(jpg|JPG|gif|GIF))[\"|'|\s]{0,}/isU",$body,$out);
return $out[4];
}
}