...
|
...
|
@@ -53,12 +53,32 @@ class Qiniu |
|
|
$previewUrl = $fileType == 'image' ? $this->getPreviewUrl($file, $watermark) : $this->getFileDownloadUrl($file);
|
|
|
$url = $fileType == 'image' ? $this->getImageUrl($file, $watermark) : $this->getFileDownloadUrl($file);
|
|
|
|
|
|
$sys = $this->getOperateSys();
|
|
|
|
|
|
if($sys == 'Linux'){
|
|
|
$file = ROOT_PATH.'public/upload/'.$file;
|
|
|
unlink($file);//适用于linux
|
|
|
}
|
|
|
return [
|
|
|
'preview_url' => $previewUrl,
|
|
|
'url' => $url,
|
|
|
];
|
|
|
}
|
|
|
|
|
|
//判断当前操作系统
|
|
|
public function getOperateSys(){
|
|
|
$os_name = php_uname('s');
|
|
|
//判断
|
|
|
if(strpos($os_name,"Linux")!==false){
|
|
|
$os_str="Linux";
|
|
|
}else if(strpos($os_name,"Windows")!==false){
|
|
|
$os_str="Windows";
|
|
|
}else{
|
|
|
$os_str='';
|
|
|
}
|
|
|
return $os_str;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取图片预览地址
|
|
|
* @param string $file
|
...
|
...
|
|