function 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.');
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.