protected function TinyPngImageHandler::isImage in TinyPNG 8
Check if given entity is a valid image.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity to check.
Return value
bool Returns if image factory validation returns TRUE.
See also
\Drupal\Core\Image\ImageInterface::isValid()
1 call to TinyPngImageHandler::isImage()
- TinyPngImageHandler::checkFile in src/
TinyPngImageHandler.php - Check if given file entity is an image with a supported type.
File
- src/
TinyPngImageHandler.php, line 204
Class
- TinyPngImageHandler
- Class TinyPngImageHandler.
Namespace
Drupal\tinypngCode
protected function isImage(EntityInterface $entity) {
$image = $this->imageFactory
->get($entity
->getFileUri());
return $image
->isValid();
}