| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function filterAction(Request $request, $endpoint) |
||
| 34 | { |
||
| 35 | $form = $this->createForm(CropType::class); |
||
| 36 | |||
| 37 | $form->handleRequest($request); |
||
| 38 | |||
| 39 | // Form invalid. Exit. |
||
| 40 | if (!$form->isValid()) { |
||
| 41 | return $this->createErrorResponse( |
||
| 42 | $this->get('translator')->trans('Invalid crop parameters') |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | |||
| 46 | // Else process crop |
||
| 47 | try { |
||
| 48 | return new JsonResponse( |
||
| 49 | $this->get('jb_fileuploader.croper')->crop($endpoint, $form->getData()) |
||
| 50 | ); |
||
| 51 | } catch (\Exception $e) { |
||
| 52 | return $this->createErrorResponse($e->getMessage()); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 73 |