|
...
|
...
|
@@ -176,7 +176,8 @@ class Template extends Common{ |
|
|
|
}*/
|
|
|
|
|
|
|
|
public function index(){
|
|
|
|
$path = $this->publicpath.'images/'.input('folder').'/';
|
|
|
|
$path = "/alidata/www/dc-api/public/tables/batchPicsyn";
|
|
|
|
|
|
|
|
$uppath = explode('/',input('folder'));
|
|
|
|
$leve = count($uppath)-1;
|
|
|
|
unset($uppath[$leve]);
|
|
...
|
...
|
@@ -211,32 +212,21 @@ class Template extends Common{ |
|
|
|
}
|
|
|
|
|
|
|
|
public function PackzipDownload(){
|
|
|
|
$path = $this->publicpath.'images/'.input('post.folder');
|
|
|
|
$path = "/alidata/www/dc-api/public/tables/batchPicsyn";
|
|
|
|
$file=$path.input('post.filename');
|
|
|
|
//首先判断是图片还是路径
|
|
|
|
if($this->isImage($file)!==false){
|
|
|
|
//是图片
|
|
|
|
$zip = new \ZipArchive;
|
|
|
|
//压缩文件名
|
|
|
|
$filename = $path.'download.zip';
|
|
|
|
$filename = 'uploads/package/download.zip';
|
|
|
|
|
|
|
|
//新建zip压缩包
|
|
|
|
$obj = $zip->open($filename,\ZIPARCHIVE::OVERWRITE | \ZIPARCHIVE::CREATE);
|
|
|
|
//把图片一张一张加进去压缩
|
|
|
|
$zip->addFile($file);
|
|
|
|
//打包zip
|
|
|
|
$zip->close();
|
|
|
|
|
|
|
|
//可以直接重定向下载
|
|
|
|
//header('Location:'.$filename);
|
|
|
|
|
|
|
|
//或者输出下载
|
|
|
|
/*header("Cache-Control: public");
|
|
|
|
header("Content-Description: File Transfer");
|
|
|
|
header('Content-disposition: attachment; filename='.basename($filename)); //文件名
|
|
|
|
header("Content-Type: application/force-download");
|
|
|
|
header("Content-Transfer-Encoding: binary");
|
|
|
|
header('Content-Length: '. filesize($filename)); //告诉浏览器,文件大小
|
|
|
|
return @readfile($filename);*/
|
|
|
|
$rs = $zip->close();
|
|
|
|
}else{
|
|
|
|
//目录
|
|
|
|
$zip = new \ZipArchive;
|
|
...
|
...
|
@@ -251,20 +241,9 @@ class Template extends Common{ |
|
|
|
}
|
|
|
|
|
|
|
|
//打包zip
|
|
|
|
$zip->close();
|
|
|
|
|
|
|
|
//可以直接重定向下载
|
|
|
|
header('Location:'.$filename);exit;
|
|
|
|
|
|
|
|
//或者输出下载
|
|
|
|
header("Cache-Control: public");
|
|
|
|
header("Content-Description: File Transfer");
|
|
|
|
header('Content-disposition: attachment; filename='.basename($filename)); //文件名
|
|
|
|
header("Content-Type: application/force-download");
|
|
|
|
header("Content-Transfer-Encoding: binary");
|
|
|
|
header('Content-Length: '. filesize($filename)); //告诉浏览器,文件大小
|
|
|
|
return @readfile($filename);
|
|
|
|
$rs = $zip->close();
|
|
|
|
}
|
|
|
|
return $rs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -285,4 +264,43 @@ class Template extends Common{ |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 二维码包下载页面
|
|
|
|
*/
|
|
|
|
public function package(){
|
|
|
|
$path = 'uploads/package/'.input('folder').'/';
|
|
|
|
|
|
|
|
$uppath = explode('/',input('folder'));
|
|
|
|
$leve = count($uppath)-1;
|
|
|
|
unset($uppath[$leve]);
|
|
|
|
if($leve>1){
|
|
|
|
unset($uppath[$leve-1]);
|
|
|
|
$uppath = implode('/',$uppath).'/';
|
|
|
|
}else{
|
|
|
|
$uppath = '';
|
|
|
|
}
|
|
|
|
$this->assign ( 'leve',$leve);
|
|
|
|
$this->assign ( 'uppath',$uppath);
|
|
|
|
$files = glob($path.'*');
|
|
|
|
$folders=array();
|
|
|
|
foreach($files as $key => $file) {
|
|
|
|
$filename = basename($file);
|
|
|
|
if(is_dir($file)){
|
|
|
|
$folders[$key]['filename'] = $filename;
|
|
|
|
$folders[$key]['filepath'] = $file;
|
|
|
|
$folders[$key]['ext'] = 'folder';
|
|
|
|
}else{
|
|
|
|
$templates[$key]['filename'] = $filename;
|
|
|
|
$templates[$key]['filepath'] = $file;
|
|
|
|
$templates[$key]['ext'] = strtolower(substr($filename,strrpos($filename, '.')-strlen($filename)+1));
|
|
|
|
if(!in_array($templates[$key]['ext'],array('zip','gif','jpg','png','bmp'))) $templates[$key]['favicon.ico'] =1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','二维码管理' );
|
|
|
|
$this->assign ( 'path',$path);
|
|
|
|
$this->assign ( 'folders',$folders );
|
|
|
|
$this->assign ( 'files',$templates );
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|