/**
  * @param MediaInterface         $media
  * @param MediaProviderInterface $provider
  * @param string                 $context
  * @param string                 $format
  *
  * @return bool
  */
 protected function processMedia(MediaInterface $media, MediaProviderInterface $provider, $context, $format)
 {
     $this->log('Deleting thumbs for ' . $media->getName() . ' - ' . $media->getId());
     try {
         if ($format === $context . '_all') {
             $format = null;
         }
         $provider->removeThumbnails($media, $format);
     } catch (\Exception $e) {
         $this->log(sprintf('<error>Unable to remove thumbnails, media: %s - %s </error>', $media->getId(), $e->getMessage()));
         return false;
     }
     return true;
 }
 /**
  * @param MediaInterface         $media
  * @param MediaProviderInterface $provider
  *
  * @return bool
  */
 protected function processMedia($media, $provider)
 {
     $this->log('Generating thumbs for ' . $media->getName() . ' - ' . $media->getId());
     try {
         $provider->removeThumbnails($media);
     } catch (\Exception $e) {
         $this->log(sprintf('<error>Unable to remove old thumbnails, media: %s - %s </error>', $media->getId(), $e->getMessage()));
         return false;
     }
     try {
         $provider->generateThumbnails($media);
     } catch (\Exception $e) {
         $this->log(sprintf('<error>Unable to generate new thumbnails, media: %s - %s </error>', $media->getId(), $e->getMessage()));
         return false;
     }
     return true;
 }