简体   繁体   English

从 URL 加载 Instagram 图像作为背景图像

[英]Load instagram image from URL as a BACKGROUND image

I can easily grab an Instagram image from its URL by adding /media/?size=l to the end, ie:我可以通过在末尾添加 /media/?size=l 轻松地从其 URL 中获取 Instagram 图像,即:

https://www.instagram.com/p/BP73IwIABjh/media/?size=l 

leads to 

https://scontent-lhr8-2.cdninstagram.com/v/t51.2885-15/e35/16228593_1671098819857382_4895739311250472960_n.jpg?tp=1&_nc_ht=scontent-lhr8-2.cdninstagram.com&_nc_cat=102&_nc_ohc=CWyp6r9aeMkAX_yPiOL&edm=AGenrX8BAAAA&ccb=7-4&oh=5674d672622792f99bc091026f209fad&oe=60BFF349&_nc_sid=5eceaa

This works great BUT I want to use this image as a background on my website.这很好用,但我想在我的网站上使用这张图片作为背景。 But without going to the URL nothing gets pulled.但是,如果不去 URL,什么都不会被拉动。 ie IE

<li style="background: #ebeefc url(https://www.instagram.com/p/BP73IwIABjh/media/?size=l) center center no-repeat;background-size:cover;">

This doesn't work and only shows the background color #ebeefc这不起作用,只显示背景颜色#ebeefc

Is it possible to load the background image from the instagram URL, or maybe use a wee bit of javascript to preload the images and pull the forwarded URL instead?是否可以从 instagram URL 加载背景图像,或者使用一点 javascript 来预加载图像并拉取转发的 ZE6B391A8D2C4D45902A23A8B6585703D? I would use the instagram API, but it doesn't seem possible to pull images that way by only using a post URL.我会使用instagram API,但似乎不可能通过仅使用帖子 URL 来拉取图像。

Any ideas welcome.欢迎任何想法。

You will have to use instagram's API.您将不得不使用 instagram 的 API。

If you read in the web page of your link it says如果您阅读链接的 web 页面,它会显示

This endpoint is deprecated.此端点已弃用。 Please read https://developers.facebook.com/docs/instagram/oembed to learn how to migrate your endpoint.请阅读https://developers.facebook.com/docs/instagram/oembed了解如何迁移您的端点。

Or you could download the image and store it yourself.或者您可以下载图像并自己存储。 I also recommend you something like https://imgur.com/ if you want to have an only storage for your image.如果您想为图像提供唯一的存储空间,我还向您推荐https://imgur.com/ 之类的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM