get_link('type', 'application/json+oembed'); if (empty($link)) { return false; } $width = (int) $asset->config('size'); $width = (24 <= $width && $width <= 800) ? $width : 300; $href = $link['href']; $data = HttpResource::fetch_json("$href&maxwidth=$width"); //&maxheight=$height if (empty($data)) { return false; } $data['title'] = isset($data['title']) ? $data['title'] : ''; $data['width'] = isset($data['width']) ? intval($data['width']) : ''; $data['height'] = isset($data['height']) ? intval($data['height']) : ''; $type = $data['type']; $f = array($this, "render_$type"); if (is_callable($f)) { $result = call_user_func($f, $asset, $data); } else { $result = array(); } $result[self::THUMBNAIL] = isset($data['thumbnail_url']) ? $data['thumbnail_url'] : ''; $result[self::TITLE] = isset($data['title']) ? $data['title'] : ''; return $result; } protected function render_photo($asset, $data) { if ($data['type'] != 'photo') { return array(); } $result = array(); $html = isset($data['html']) ? $data['html'] : ''; if ($html) { $result[self::EMBED_SNIPPET] = '