setDimensions example


  public static function photo($url$width$height = NULL, Provider $provider = NULL, $title = NULL, $author_name = NULL, $author_url = NULL, $cache_age = NULL, $thumbnail_url = NULL, $thumbnail_width = NULL, $thumbnail_height = NULL) {
    if (empty($url)) {
      throw new \InvalidArgumentException('Photo resources must provide a URL.');
    }

    $resource = static::link($url$provider$title$author_name$author_url$cache_age$thumbnail_url$thumbnail_width$thumbnail_height);
    $resource->type = self::TYPE_PHOTO;
    $resource->setDimensions($width$height);

    return $resource;
  }

  /** * Creates a rich resource. * * @param string $html * The HTML representation of the resource. * @param int $width * The width of the resource, in pixels. * @param int $height * (optional) The height of the resource, in pixels. * @param \Drupal\media\OEmbed\Provider $provider * (optional) The resource provider. * @param string $title * (optional) A text title, describing the resource. * @param string $author_name * (optional) The name of the author/owner of the resource. * @param string $author_url * (optional) A URL for the author/owner of the resource. * @param int $cache_age * (optional) The suggested cache lifetime for this resource, in seconds. * @param string $thumbnail_url * (optional) A URL to a thumbnail image representing the resource. If this * parameter is present, $thumbnail_width and $thumbnail_height must also be * present. * @param int $thumbnail_width * (optional) The width of the thumbnail, in pixels. If this parameter is * present, $thumbnail_url and $thumbnail_height must also be present. * @param int $thumbnail_height * (optional) The height of the thumbnail, in pixels. If this parameter is * present, $thumbnail_url and $thumbnail_width must also be present. * * @return static */
Home | Imprint | This part of the site doesn't use cookies.