|
@@ -144,7 +144,7 @@ discard block |
|
|
block discarded – undo |
|
144
|
144
|
#[NoAdminRequired] |
|
145
|
145
|
#[BruteForceProtection(action: 'text2image')] |
|
146
|
146
|
#[ApiRoute(verb: 'GET', url: '/task/{id}/image/{index}', root: '/text2image')] |
|
147
|
|
- public function getImage(int $id, int $index): DataResponse|FileDisplayResponse { |
|
|
147
|
+ public function getImage(int $id, int $index): DataResponse | FileDisplayResponse { |
|
148
|
148
|
try { |
|
149
|
149
|
$task = $this->textToImageManager->getUserTask($id, $this->userId); |
|
150
|
150
|
try { |
|
@@ -154,7 +154,7 @@ discard block |
|
|
block discarded – undo |
|
154
|
154
|
$res->throttle(['action' => 'text2image']); |
|
155
|
155
|
return $res; |
|
156
|
156
|
} |
|
157
|
|
- $file = $folder->getFolder((string)$task->getId())->getFile((string)$index); |
|
|
157
|
+ $file = $folder->getFolder((string) $task->getId())->getFile((string) $index); |
|
158
|
158
|
$info = getimagesizefromstring($file->getContent()); |
|
159
|
159
|
|
|
160
|
160
|
return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => image_type_to_mime_type($info[2])]); |
|
@@ -221,7 +221,7 @@ discard block |
|
|
block discarded – undo |
|
221
|
221
|
public function listTasksByApp(string $appId, ?string $identifier = null): DataResponse { |
|
222
|
222
|
try { |
|
223
|
223
|
$tasks = $this->textToImageManager->getUserTasksByApp($this->userId, $appId, $identifier); |
|
224
|
|
- $json = array_values(array_map(static function (Task $task) { |
|
|
224
|
+ $json = array_values(array_map(static function(Task $task) { |
|
225
|
225
|
return $task->jsonSerialize(); |
|
226
|
226
|
}, $tasks)); |
|
227
|
227
|
|