문제

Need a way for Facebook to render an image in wall posts. Sometimes, all you need to do is copy and paste the link to the image, like here:Working rendered image in Facebook wall post

But, with the images I need to link to, which are on S3, I get this:Image link not being rendered in Facebook wall post

You can click here to verify that the second link is in fact a valid image address (you should see a creepy hand drawn smiley face).

I did this test just using the normal Facebook GUI on the site, but I will be using the answer to this question in my app, which integrates with Facebook via the Open Graph API. (In case anyone thought this question was not programming related).

Anyone know what I need to do to get the second image to render in the post?

도움이 되었습니까?

해결책

The key is image size. Don't ask me what the magic number is, but larger images work and smaller ones don't. It could be that it has to be larger than the preview size that facebook uses.

In my test, I had static website configuration turned off.

다른 팁

My guess is only static links will generate a thumbnail for posts on facebook. The link you are trying to use not a static one.

This is what Facebook gets when trying to generate a thumbnail.

<Error>
<SCRIPT/>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>D577337ADC9FA36A</RequestId>
<HostId>
DN9BnBduVLgHbf2lONA+e/fXQIOuT7W3WOFUPdthdpP2MZQhSLlolTvyJ0t9eZXn
</HostId>
</Error>

Solution :

It turns out that to make it work, you cannot just map any arbitrary subdomain to any arbitrary bucket. The fully qualified subdomain name must be the same as the S3 bucket name.

  1. Suppose the name of your site is static.mydomain.com. Then you need to create a S3 bucket with that same name, named static.mydomain.com.

  2. Once you configure that bucket as a S3 static web site, it will have a URL assigned to it that looks something like http://static.mydomain.com.s3-website-us-east-1.amazonaws.com.

  3. Go to your domain host and map your subdomain to the URL from step 2. In enom.com, that meant mapping the host "static" to the address "static.mydomain.com.s3-website-us-east-1.amazonaws.com" as a CNAME record.

Source, it will help you host a static site from your S3 account. Use images from that custom domain URL path. That will work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top