public function BlazyOEmbed::getExternalImageItem in Blazy 8.2
Returns external image item from resource relevant to BlazyFilter.
File
- src/
BlazyOEmbed.php, line 253
Class
- BlazyOEmbed
- Provides OEmbed integration.
Namespace
Drupal\blazyCode
public function getExternalImageItem(array &$settings) {
// Iframe URL may be valid, but not stored as a Media entity.
if (($resource = $this
->getResource($settings['input_url'])) && $resource
->getThumbnailUrl()) {
// All we have here is external images. URI validity is not crucial.
$settings['uri'] = $settings['image_url'] = $resource
->getThumbnailUrl()
->getUri();
$settings['type'] = $resource
->getType();
// Respect hard-coded width and height since no UI for all these here.
if (empty($settings['width'])) {
$settings['width'] = $resource
->getThumbnailWidth() ?: $resource
->getWidth();
$settings['height'] = $resource
->getThumbnailHeight() ?: $resource
->getHeight();
}
return Blazy::image($settings);
}
return NULL;
}