public function filterAction(Request $request, $endpoint)
    {
        $form = $this->createForm(CropType::class);

        $form->handleRequest($request);

        // Form invalid. Exit.
        if (!$form->isValid()) {
            return $this->createErrorResponse(
                $this->get('translator')->trans('Invalid crop parameters')
            );
        }

        // Else process crop
        try {
            return new JsonResponse(
                $this->get('jb_fileuploader.croper')->crop($endpoint, $form->getData())
            );
        } catch (\Exception $e) {
            return $this->createErrorResponse($e->getMessage());
        }
    }
public function filterAction(Request $request, $endpoint)
    {
        $form = $this->createForm(CropType::class);

        $form->handleRequest($request);

        // Form invalid. Exit.
        if (!$form->isValid()) {
            return $this->createErrorResponse(
                $this->get('translator')->trans('Invalid crop parameters')
            );
        }

        // Else process crop
        try {
            return new JsonResponse(
                $this->get('jb_fileuploader.croper')->crop($endpoint, $form->getData())
            );
        } catch (\Exception $e) {
            return $this->createErrorResponse($e->getMessage());
        }
    }
public function filterAction ( Request $ request , $ endpoint ) { $ form = $ this -> createForm ( CropType :: class ) ; $ form -> handleRequest ( $ request ) ; // Form invalid. Exit. if ( ! $ form -> isValid ( ) ) { return $ this -> createErrorResponse ( $ this -> get ( 'translator' ) -> trans ( 'Invalid crop parameters' ) ) ; } // Else process crop try { return new JsonResponse ( $ this -> get ( 'jb_fileuploader.croper' ) -> crop ( $ endpoint , $ form -> getData ( ) ) ) ; } catch ( \ Exception $ e ) { return $ this -> createErrorResponse ( $ e -> getMessage ( ) ) ; } }
Filter for croping

@param Request $request
@param string $endpoint

@return JsonResponse
Filter for croping