首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Embedly.oembed不依附于最大宽度参数

Embedly.oembed不依附于最大宽度参数
EN

Stack Overflow用户
提问于 2015-08-18 20:01:45
回答 1查看 143关注 0票数 0

我试图使用爱默生为给定的url生成一个缩略图。我需要缩略图小于最大大小,所以我按如下方式调用api:

代码语言:javascript
复制
url = "http://embed.ly"
embedly_api = Embedly::API.new(key: ENV['EMBEDLY_KEY'])
obj = embedly_api.oembed(url: url, maxwidth: 50, type: 'photo').first

json_obj = JSON.pretty_generate(obj.marshal_dump)

代码语言:javascript
复制
http://api.embed.ly/1/oembed?key=[KEY_VALUE]&url=http://embed.ly&maxwidth=50&type=photo

无论是哪种情况,结果都是:

代码语言:javascript
复制
{
  provider_url: "http://embed.ly",
  description: "Embedly delivers the ultra-fast,...",
  title: "Embedly makes your content more engaging and easier...",
  mean_alpha: 32.7480314961,
  thumbnail_width: 399,
  url: "http://embed.ly",
  thumbnail_url: "http://embed.ly/static/images/logos/logo_color.png?v=4b245",
  version: "1.0",
  provider_name: "Embedly",
  type: "link",
  thumbnail_height: 127
}

注意,thumbnail_width是399 (这比我传入的maxwidth参数要大)。我是不是漏掉了什么明显的东西?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-18 21:07:49

maxwidth只适用于html,图像可以任意宽度。

但是,Embedly允许您设置一个image_width。尝试:

代码语言:javascript
复制
embedly_api.oembed(url: url, maxwidth: 50, type: 'photo', image_width: 50)

http://embed.ly/docs/api/display/integration

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32081617

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档