mirror of https://github.com/IoTcat/img-api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
690 B
31 lines
690 B
<?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);
|
|
|