/** download */ if ($action == 'down') { $pagesize = 3; $curpage = $curpage + 1;

$where = "web_status=3";
if ($type == 'part') {
	$where .= " AND web_pic=''";
}

$websites = $DB->fetch_all("SELECT web_id, web_name, web_url FROM $table WHERE $where ORDER BY web_id DESC LIMIT $start, $pagesize");
$totalnum = $DB->get_count($table, $where);
$totalpage = @ceil($totalnum / $pagesize);

echo '<div style="font-size: 12px; line-height: 25px; padding: 10px;">';
if ($curpage <= $totalpage) {
	$savepath = '../'.$options['upload_dir'].'/website/';
	
	echo '<meta http-equiv="refresh" content=3;url="'.$fileurl.'?act='.$action.'&type='.$type.'&page='.$curpage.'">';
	echo '<h3>共需采集 '.$totalpage.' 页,每次下载 '.$pagesize.' 张,当前第 '.$curpage.' 页,正在下载远程图片...</h3>';
	foreach ($websites as $row) {
		$filepath = save_to_local(str_replace('/', '.', $row['web_url']), $savepath);
		$filesize = filesize($filepath);
		
		if ($filesize < 10240) {
			$newpath = str_replace('../image/', '', $filepath);
			if (!empty($newpath)) {
				$status = '下载成功!';
				$DB->update($table, array('web_pic' => $newpath), array('web_id' => $row['web_id']));
			} else {
				$status = '下载失败!';
			}
		} else {
			$status = '文件大小超过限制!';
		}
		echo $row['web_id'].' - '.$row['web_name'].' ------ '.$status.'<br />';
	}
	echo '<h3>本页已采集完成,5秒后将自动采集下一页...<h3>';
} else {
	echo '<h3>已经将所有的远程图片本地化!</h3>';	
}
echo '</div>';
把下面的代码修改成小于10KB不下载 download if $action == down 	$pagesize = 3;	$curpage = $curpage + 1;	$where = web_status=3;	if $type == part 		$where = AND web_pic=;			$websites = $DB-fetch_allSELECT web_id web_n

原文地址: http://www.cveoy.top/t/topic/iT3t 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录