mirror of https://github.com/IoTcat/img-api.git
parent
61bed92755
commit
2064dcaafd
3 changed files with 33 additions and 2 deletions
@ -0,0 +1,31 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
include 'functions.php'; |
||||||
|
|
||||||
|
$type = $_GET['type']; |
||||||
|
$limit = $_GET['limit']; |
||||||
|
$sort = $_GET['sort']; |
||||||
|
|
||||||
|
if(!isset($type) || !($type == 'moe' || $type == 'wallpaper' || $type == 'head' || $type == 'koino' || $type == 'imgbed')) $type = 'moe'; |
||||||
|
if(!isset($limit)) $limit = 30; |
||||||
|
if(!isset($sort)) $sort = 'random'; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$data = getImgsInfo($type); |
||||||
|
|
||||||
|
if($sort == 'random') shuffle($data[0]); |
||||||
|
if($sort == 'reverse') $data[0] = array_reverse($data[0]); |
||||||
|
if($limit >= 0) $data[0] = array_slice($data[0], 0, $limit); |
||||||
|
|
||||||
|
$o = array(); |
||||||
|
|
||||||
|
foreach($data[0] as $val){ |
||||||
|
$o[] = array( |
||||||
|
"name" => $val, |
||||||
|
"url" => 'https://api.yimian.xyz/img/?path='.$type.'/'.$val |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
echo json_encode($o); |
Loading…
Reference in new issue