private function getImage(FileInterface $file) {
    // Make sure we deal with a file.
    $image_factory = \Drupal::service('image.factory');

    return $image_factory->get($file->getFileUri());
  }
private function getImage(FileInterface $file) {
    // Make sure we deal with a file.
    $image_factory = \Drupal::service('image.factory');

    return $image_factory->get($file->getFileUri());
  }
private function getImage ( FileInterface $ file ) { // Make sure we deal with a file. $ image_factory = \ Drupal :: service ( 'image.factory' ) ; return $ image_factory -> get ( $ file -> getFileUri ( ) ) ; }
Grab the Image if we are dealing with one.

@param \Drupal\file\FileInterface $file
A file entity. This function may resize the file affecting its size.

@return \Drupal\Core\Image\ImageInterface
An Image object.
Grab the Image if we are dealing with one .