PartKeepr\ImageBundle\Controller\TemporaryImageController::webcamUploadAction PHP Method

webcamUploadAction() public method

Uploads a webcam image.
public webcamUploadAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request The request to process
return Symfony\Component\HttpFoundation\Response
    public function webcamUploadAction(Request $request)
    {
        $image = new TempImage();
        $imageService = $this->get('partkeepr_image_service');
        $data = $request->getContent();
        $base64 = explode(',', $data);
        $imageService->replaceFromData($image, base64_decode($base64[1]), 'webcam.png');
        $this->getDoctrine()->getManager()->persist($image);
        $this->getDoctrine()->getManager()->flush();
        return $image;
    }