/**
  * {@Inheritdoc}
  * @param Image $image
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function getAdditionalData($image)
 {
     $media = $image->getFile();
     $provider = $this->sonataMediaPool->getProvider($media->getProviderName());
     $formatNames = $this->sonataMediaPool->getFormatNamesByContext($media->getContext());
     $thumbnails = [];
     foreach ($formatNames as $formatName => $details) {
         $thumbnails[$formatName] = $this->generateFullPublicUrl($provider->generatePublicUrl($media, $formatName));
     }
     $reference = $this->generateFullPublicUrl($provider->generatePublicUrl($media, 'reference'));
     return ['url' => $reference, 'thumbnails' => $thumbnails];
 }
 /**
  * @param UploadedFile $uploadedFile
  * @param string $context
  * @return Image
  */
 private function saveImage(UploadedFile $uploadedFile, $context)
 {
     $media = new Media();
     $media->setBinaryContent($uploadedFile);
     $media->setContext($context);
     $media->setProviderName('sonata.media.provider.image');
     $this->mediaManager->save($media);
     $image = new Image();
     $image->setFile($media);
     $this->imageManager->save($image);
     return $image;
 }