You are here

public static function InsertUtility::isImage in Insert 8.2

Parameters

\Drupal\file\FileInterface $file:

Return value

bool

2 calls to InsertUtility::isImage()
insert_insert_process in ./insert.module
Implements hook_insert_process().
insert_insert_variables in ./insert.module
Implements hook_insert_variables().

File

src/Utility/InsertUtility.php, line 109

Class

InsertUtility

Namespace

Drupal\insert\Utility

Code

public static function isImage($file) {

  /** @var \Drupal\Core\Image\Image $image */
  $image = \Drupal::service('image.factory')
    ->get($file
    ->getFileUri());
  return $image
    ->isValid();
}