gpt4 book ai didi

thumbnails - 更改 Google 自定义搜索 API 结果中的缩略图大小

转载 作者:行者123 更新时间:2023-12-02 14:47:42 25 4
gpt4 key购买 nike

我正在使用 Google 自定义搜索 API 搜索要在我的网站中显示的图像。但缩略图太小,我找不到控制缩略图大小的方法。以下是我的查询的回复:

{
"kind": "customsearch#result",
"title": "Big Ben Street London United Kingdom Photo Shared By Halsy16 ...",
"htmlTitle": "Big Ben Street \u003cb\u003eLondon United Kingdom\u003c/b\u003e Photo Shared By Halsy16 \u003cb\u003e...\u003c/b\u003e",
"link": "http://www.fansshare.com/photos/london/big-ben-street-london-united-kingdom-784722294.jpg",
"displayLink": "www.fansshare_com",
"snippet": "Robert Pattinson's new London",
"htmlSnippet": "Robert Pattinson's new \u003cb\u003eLondon\u003c/b\u003e",
"mime": "image/jpeg",
"image": {
"contextLink": "http://www.fansshare_com/gallery/photos/10677077/big-ben-street-london-united-kingdom/",
"height": 640,
"width": 1024,
"byteSize": 80611,
"thumbnailLink": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSZJRKQ-yIiSt1FCeYdBKLUEft54xHJo095_r9-rN8OrILnOZPnJZvcwNsG",
"thumbnailHeight": 94,
"thumbnailWidth": 150
}

有人可以告诉我是否有办法获得更大的缩略图吗?或者是否有其他方法可以像 Google 图片搜索一样显示搜索结果?非常感谢!

最佳答案

我假设您正在使用 Google Custom Search API因为图像 API 已被弃用。

无法告诉 Google 提供更大的缩略图尺寸 AFAICS,但您有两种可能的解决方法:

  • 使用图像 url 作为您选择的元素的 CSS 背景图像属性(例如,类为“portrait”的 div),并使用背景位置:覆盖来确保图像放大或缩小覆盖整个元素屏幕区域(这里是 example:安迪·沃霍尔的肖像是通过 Google 获取的)
  • 链接到完整图像而不是缩略图(示例中的 link 查询参数)(但这可能很危险,因为您必须避免巨大和过小的图像)

请务必尝试 api Explorer及其参数。

关于thumbnails - 更改 Google 自定义搜索 API 结果中的缩略图大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28212414/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com