简体   繁体   English

Facebook iOS应用和网站供稿上的不同图像

[英]Different images on Facebook iOS app and website feeds

I have an iOS app that allows users to post pictures (along with a link, etc.) to their own Facebook feed using the Graph API's me/feed edge. 我有一个iOS应用程序,允许用户使用Graph API的“我/订阅源”边缘将图片(以及链接等)发布到自己的Facebook订阅源中。

The images are generated by a PHP script on my server using GD to optimise the image. 这些图像是由服务器上的PHP脚本使用GD生成的,用于优化图像。 I would like to serve different images based on whether the feed is being viewed in the Facebook iOS app or on the Facebook website. 我想根据是在Facebook iOS应用程序中还是在Facebook网站上查看提要来提供不同的图像。

I have tried using the HTTP User Agent to detect if a user is viewing the feed item via the FB iOS app or the FB website. 我尝试使用HTTP用户代理检测用户是否正在通过FB iOS应用或FB网站查看供稿项目。 However, in both cases, the user agent is set as: 但是,在两种情况下,用户代理都设置为:

facebookexternalhit/1.1 (*https://www.facebook.com/externalhit_uatext.php*)

Any help on how to achieve this would be highly appreciated. 对于如何实现这一目标的任何帮助将不胜感激。

Cheers 干杯

Have you looked at all the request headers for both requests? 您是否查看了两个请求的所有请求标头? Any difference you can spot between the two? 两者之间有什么区别吗?

Alternatively, you can add a parameter to your own requested url from your iOS app; 另外,您可以在iOS应用中将参数添加到自己的请求网址中; there you have control over the requested url. 在那里您可以控制所请求的网址。 On your server you can then detect that parameter and render a different image. 然后,您可以在服务器上检测到该参数并渲染不同的图像。

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

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