|
@@ 177-182 (lines=6) @@
|
| 174 |
|
); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
if ($node->getMimeType() !== 'image/jpeg' && $node->getMimeType() !== 'image/png') { |
| 178 |
|
return new JSONResponse( |
| 179 |
|
['data' => ['message' => $this->l->t('The selected file is not an image.')]], |
| 180 |
|
Http::STATUS_BAD_REQUEST |
| 181 |
|
); |
| 182 |
|
} |
| 183 |
|
|
| 184 |
|
try { |
| 185 |
|
$content = $node->getContent(); |
|
@@ 231-237 (lines=7) @@
|
| 228 |
|
|
| 229 |
|
if ($image->valid()) { |
| 230 |
|
$mimeType = $image->mimeType(); |
| 231 |
|
if ($mimeType !== 'image/jpeg' && $mimeType !== 'image/png') { |
| 232 |
|
return new DataResponse( |
| 233 |
|
['data' => ['message' => $this->l->t('Unknown filetype')]], |
| 234 |
|
Http::STATUS_OK, |
| 235 |
|
$headers |
| 236 |
|
); |
| 237 |
|
} |
| 238 |
|
|
| 239 |
|
$this->cache->set('tmpAvatar', $image->data(), 7200); |
| 240 |
|
return new DataResponse( |