Fix: img preview wont require height and width anymore

This commit is contained in:
HFO4 2019-03-07 17:20:18 +08:00
parent c741d79677
commit c94e17a4da
3 changed files with 10 additions and 9 deletions

View file

@ -64,7 +64,7 @@ class File extends Controller{
}
public function Preview(){
$reqPath = $_GET["path"];
$reqPath =$_GET["path"];
$fileObj = new FileManage($reqPath,$this->userObj->uid);
$Redirect = $fileObj->PreviewHandler();
if($Redirect[0]){
@ -74,7 +74,7 @@ class File extends Controller{
public function ListPic(){
$reqPath = $_GET["path"];
return FileManage::listPic($reqPath,$this->userObj->uid);
return json(FileManage::listPic($reqPath,$this->userObj->uid));
}
public function Download(){

View file

@ -622,20 +622,20 @@ class FileManage extends Model{
foreach ($fileList as $key => $value) {
if($value["orign_name"] == $firstPreview[0]){
$previewPicInfo = explode(",",$value["pic_info"]);
$previewSrc = $url."action=preview&path=".$path."/".$value["orign_name"];
$previewSrc = $url."action=preview&path=".urlencode($path."/".$value["orign_name"]);
}else{
$picInfo = explode(",",$value["pic_info"]);
$fileListData[$count]['src'] = $url."action=preview&path=".$path."/".$value["orign_name"];
$fileListData[$count]['w'] = $picInfo[0];
$fileListData[$count]['h'] = $picInfo[1];
$fileListData[$count]['w'] = 0;
$fileListData[$count]['h'] = 0;
$fileListData[$count]['title'] = $value["orign_name"];
$count++;
}
}
array_unshift($fileListData,array(
'src' => $previewSrc,
'w' => $previewPicInfo[0],
'h' => $previewPicInfo[1],
'w' => 0,
'h' => 0,
'title' => $firstPreview[0],
));
return $fileListData;

View file

@ -33,7 +33,8 @@
allowTorrentDownload:"{:explode(",",$groupData.aria2)[1]}",
};
apiURL={
imgThumb:"/File/Thumb"
imgThumb:"/File/Thumb",
preview:"/File/Preview",
};
mediaType = {}
</script>
@ -55,5 +56,5 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<script src="http://localhost:3000/static/js/bundle.js"></script><script src="http://localhost:3000/static/js/0.chunk.js"></script><script src="http://localhost:3000/static/js/main.chunk.js"></script>
<script src="http://localhost:3000/static/js/bundle.js"></script><script src="http://localhost:3000/static/js/0.chunk.js"></script><script src="http://localhost:3000/static/js/1.chunk.js"></script><script src="http://localhost:3000/static/js/main.chunk.js"></script>
</html>