protected function Resource::setThumbnailDimensions in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/src/OEmbed/Resource.php \Drupal\media\OEmbed\Resource::setThumbnailDimensions()
- 10 core/modules/media/src/OEmbed/Resource.php \Drupal\media\OEmbed\Resource::setThumbnailDimensions()
Sets the thumbnail dimensions.
Parameters
int $width: The width of the resource.
int $height: The height of the resource.
Throws
\InvalidArgumentException If either $width or $height are not numbers greater than zero.
1 call to Resource::setThumbnailDimensions()
- Resource::__construct in core/
modules/ media/ src/ OEmbed/ Resource.php - Resource constructor.
File
- core/
modules/ media/ src/ OEmbed/ Resource.php, line 497
Class
- Resource
- Value object representing an oEmbed resource.
Namespace
Drupal\media\OEmbedCode
protected function setThumbnailDimensions($width, $height) {
$width = (int) $width;
$height = (int) $height;
if ($width > 0 && $height > 0) {
$this->thumbnailWidth = $width;
$this->thumbnailHeight = $height;
}
else {
throw new \InvalidArgumentException('The thumbnail dimensions must be numbers greater than zero.');
}
}