Skip to content

Instantly share code, notes, and snippets.

@init90
Created February 13, 2018 14:30
Show Gist options
  • Save init90/b52a60499eef37e0258a62d22e3932dc to your computer and use it in GitHub Desktop.
Save init90/b52a60499eef37e0258a62d22e3932dc to your computer and use it in GitHub Desktop.
Drupal 8, check if image is valid.
$image_factory = \Drupal::service('image.factory');
$image = $image_factory->get($file->getFileUri());
if (!$image->isValid()) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment