/**
  * {@inheritdoc}
  */
 public function resizeImage($path, array $size, $mode = null)
 {
     if (null === $mode) {
         $mode = ImageResizerInterface::INSET;
     }
     $path = $this->getImagePath($path);
     if (empty($size)) {
         return $path;
     }
     return $this->imageResizer->resize($path, $size, $mode);
 }
 public function cropAction(Request $request)
 {
     $coordinates = $request->get('coordinates', null);
     $filename = $request->get('filename', null);
     if (!$filename || null === $coordinates) {
         throw new NotFoundHttpException('Invalid coordinates or filename request parameters!');
     }
     $image = $this->imageManager->findByFilename($filename);
     if (null === $image) {
         throw new NotFoundImageException('Image not found!');
     }
     $data = $this->imageCropHandler->process($coordinates, $image);
     $data['thumbnail_path'] = $this->imageResizer->resize($image->getPath(), array(150, 150), ImageResizerInterface::INSET);
     return new JsonResponse($data);
 }