Fix: img preview wont require height and width anymore

pull/141/head
HFO4 7 years ago
parent c741d79677
commit c94e17a4da

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

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

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

Loading…
Cancel
Save