parent
e3186c1759
commit
7f58cf51c0
|
@ -76,15 +76,9 @@ class ImageController extends GenericApiController
|
||||||
*
|
*
|
||||||
* Get preview of many images
|
* Get preview of many images
|
||||||
*/
|
*/
|
||||||
public function multipreview(): Http\Response
|
public function multipreview(array $files): Http\Response
|
||||||
{
|
{
|
||||||
return Util::guardExDirect(function (Http\IOutput $out) {
|
return Util::guardExDirect(function (Http\IOutput $out) use ($files) {
|
||||||
// read body to array
|
|
||||||
$body = file_get_contents('php://input');
|
|
||||||
|
|
||||||
/** @var array<array> */
|
|
||||||
$files = json_decode($body, true);
|
|
||||||
|
|
||||||
// Filter files with valid parameters
|
// Filter files with valid parameters
|
||||||
$files = array_filter($files, static function (array $file) {
|
$files = array_filter($files, static function (array $file) {
|
||||||
return isset($file['reqid'], $file['fileid'], $file['x'], $file['y'], $file['a'])
|
return isset($file['reqid'], $file['fileid'], $file['x'], $file['y'], $file['a'])
|
||||||
|
|
|
@ -303,10 +303,8 @@ async function fetchOneImage(url: string) {
|
||||||
async function fetchMultipreview(files: any[]) {
|
async function fetchMultipreview(files: any[]) {
|
||||||
return await fetch(config.multiUrl, {
|
return await fetch(config.multiUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(files),
|
body: JSON.stringify({ files }),
|
||||||
headers: {
|
headers: { 'Content-Type': 'application/json' },
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue