I was trying to find this on facebook's site in their documentation but so far no luck. I'm sure others must have run into this before.
I use Amazon S3 for storing images. I didn't know ahead of time that if I named my bucket as my domain name with subdomain I could link that way, so until I move all of the pictures I have to link to mybucket.s3.amazonaws.com domain. When I include a picture from there with a post to the wall the picture doesn't show up. If I change the picture to one on the server itself the picture does show up. It seems that the domain name of the picture must match my app? I looked at bugzilla and didn't see this mentioned. Facebook's forum says to post questions here.
I'm using the C# Facebook SDK from CodePlex.
My code looks like (with error handling and authentication check removed):
var client = new FacebookClient(FACEBOOK_APP_ID, FACEBOOK_SECRET);
client.AccessToken = facebook.AccessToken;
var parameters = new Dictionary<string, object>();
parameters.Add("name", name);
parameters.Add("caption", title);
parameters.Add("message", message);
parameters.Add("link", link);
parameters.Add("source", link);
parameters.Add("picture", imageUrl);
client.Post("me/feed", parameters);
I verified that imageUrl does indeed have a correct picture, the domain name just doesn't match. The picture on amazon s3 has public read access. I can view it from my browser so I don't think it's a permission problem. I've tried a few different pictures with the same problem. Only time it's worked so far is when the picture was on the server itself.
So, my question is, is it a problem with me, or does facebook block images that don't match the domain name specified on the app?
You can upload the picture from that url, then add its object id in the post.
Refer to: http://developers.facebook.com/blog/post/526/?ref=nf
Uploading Photos to the Graph API via a URL
Earlier this year, we released support for uploading photos directly
via the Graph API. This requires sending the photo as a MIME-encoded
form field. We are now enhancing our photo upload capability by
introducing the ability to upload photos simply by providing a URL to
the image. This simplifies photo management for a number of use cases:
App developers who host their images on Amazon S3 or a similar
service can pass the S3 URL directly to Facebook without having to
download the file to their application servers only to upload it
again to Facebook. This improves performance and reduces costs for
developers.
Apps written on platforms that don't have good support for
multipart file uploads can create new photos more easily.
To upload a photo via a URL, simply issue an HTTP POST to
ALBUM_ID/photos with the url field set to the URL of the photo you
wish to upload. You need the publish_stream permission to perform this
operation. You can also include an optional message parameter to set a
caption for the photo.
I'am facing the same issue as well. Based on my observations it seems that facebook does not like it when the picture url has more than one sub-domain.
I tried the below 2 URL variations for the same image..
mybucket.s3.amazonaws.com - throws an error
s3.amazonaws.com/mybucket - works fine
:picture => 'http://mybucket.s3.amazonaws.com/footprints/15/coverimgs/medium.jpg'
OAuthException: (#100) picture URL is not properly formatted
:picture => 'http://s3.amazonaws.com/mybucket/footprints/15/coverimgs/medium.jpg'
{"id"=>"587472956_10150280873767957"}
Now i have to figure out how to change the URL structure for the image while passing it to the FB graph API.
I would log it as a bug. If this is really the case, which I kinda doubt, you could create a 301 redirect on your own domain for each image that redirects to the Amazon url.
Related
The question is pretty vague but here's the entire problem statement. I am using Django REST APIs, and I'm generating invocies for my clients. Using wkhtmltopdf, I'm able to generate a PDF file which gets automatically backed up to S3. Now, we need to retreive the said invoice once our client clicks on a link.
We're using pre-signed URLs right now, which last for 12 hours, right? Once that link expires, the entire backend fails.
I mean, even if we go for permanent pre-signed links, would there not be a security issue?
I could really use some guidance on this.
Now, we need to retreive the said invoice once our client clicks on a link.
We're using pre-signed URLs right now [...]
Only generate the pre-signed URL for a given S3 URI when the authenticated client clicks on the link. You can then give it a very short expiry.
We have a problem when users update the og:image for an article.
The Open Graph Debugger picks up the new image, and our CMS triggers a scrape using the API endpoint documented here.
But for existing shares, Facebook renders a placeholder and doesn't update to the new og:image URL. Which means if the original image is deleted in our CMS, Facebook shows a blank placeholder:
Facebook's documentation says:
You can always edit an object's properties, with two exceptions:
Title: Once 50 actions (likes, shares and comments) have been associated with an object, you won't be able to update its title
Type: An object's type can't be changed once it's been used in a story
If you want to update an image for an object, we strongly suggest that the URL to the image be different than the original image URL. Caching may prevent the image from being updated.
Images uploaded to our CMS always have unique filenames, and are served from an Amazon S3 bucket via Cloudflare.
If we don't delete the original image from our server, in existing shares Facebook continues to use the original in spite of the og:image changing and us telling FB to re-scrape the URL.
How can we get the image to update?
Twitter and Linkedin do not have a problem as they appear to cache the original image on their servers, so once we delete the file they continue to serve the original og:image. That's fine - but Facebook needs to show an image.
Try ?v=2 at the end of og:image url.
I am using facebook-cordova -> "Simple Facebook" -> Facebook SDK -> Graph API from an android app and an IOS app.
The functions I use in facebook-cordova to do the actual postings are named .feed() and .share(). They seems to be interchangeable on android i.e. result in the same graph api call in the other end.
What I need is to add images to a posting, preferrably by url.
(I have already managed to do postings without images, using app key and access token etc),
When glancing the facebook SDK for android, it seems there is no obvious way to add images to a status message.
On the other hand, it is possible, right?
The usual way to do this is to post a photo:
https://developers.facebook.com/docs/graph-api/reference/v2.1/user/photos
Of course the same rules apply to the message parameter, no prefilling is allowed, the value must be 100% user generated.
How to do this with Cordova should be explained here: Phonegap/Cordova Upload photo to graph.facebook - requires upload file
Remember that every photo in your profile is in an album: https://www.facebook.com//photos_albums
Afaik you can upload photos to every album except for the profile pictures.
I operate a website, http://www.plingo.com.br/
I have created a like button for that webpage, as well as specified opengraph tags that point back to the same URL and included a video.
I have set the og:type tag to 'blog'.
When someone clicks Like, the video and URL get posted to the users feed as expected.
However, my issue revolves around being able to publish to users of my feed.
As you can see in my opengraph tags, I have associated my URL to a facebook application that I own.
I have followed the instructions at developers.facebook.com/docs/opengraph/ on how to publish to my feed directly, however when I run the PHP script, I receive this error:
"error": {
"message": "(#100) (the url) does not resolve to a valid user ID",
"type": "OAuthException"
}
However, the opengraph at the URL points both to my facebook account as well as my application.
I have no idea why I am unable to do this.
However, to try to diagnose the issue, I made a similar webpage at http://www.plingo.com.br/ogtest.php and set all the attributes of the opengraph tags the same, except for the og:url and the youtube video. Running the publish script using that URL however, works fine, and facebook even generated an administrative page for publishing to facebook.
I am wondering why this is not working with my root URL. Is there any way to get Facebook to give me an Administrative Page? Why can't I publish, even though I have associated the opengraph IDs properly?
I would GREATLY appreciate any input as I have tried countless different things, changes, etc to see where the issue lies.
Thank you
The Twitter API returns this value for the Twitter account 'image_url':
http://a1.twimg.com/profile_images/75075164/twitter_bird_profile_bigger.png
In my Twitter client webapp, I am considering hotlinking the HTTPS version of avatars which is hosted on Amazon S3 : https://s3.amazonaws.com/twitter_production/profile_images/75075164/twitter_bird_profile_bigger.png
Any best practices which would discourage me from doing this ? Do 3rd party Twitter client applications typically host their own copies of avatars ?
EDIT: To clarify, I need to use HTTPS for images because my webapp will use a HTTPS connection and I don't want my users to get security warnings from their browser about the page containing some content which is not authenticated. For example, Firefox is known to complain about mixed http/https content.
My problem is to figure out whether or not hotlinking the https URLs is forbidden by Twitter, since these URLs are not "public" from their API. I got them by analyzing their web client HTML source when connected to my Twitter account in HTTPS.
Are you thinking of storing the image URL in your application or retrieving it for the user as it is required?
If its the latter option then I don't see an issue with hot-linking the images. If you are storing the location of the image url in your own system then I see you having broken links whenever the images change (I'm sure they will change the URLs at some point in the future).
Edit
Ok, now i see your dilemma. I've looked through the API docs and there doesnt seem to be too much in terms of being able to get images served in HTTPS or getting the URL of the Amazon S3 image. You could possibly write a handler on your own server that would essentially cache & re-serve the HTTP image as HTTPS however thats a bit of un-neccesary load on your servers. Short of that I haven't come across a better solution. GL
the things seems updated since that.
Please check: https://dev.twitter.com/docs/user-profile-images-and-banners
The SSL-enabled path template for a profile image is indicated in the profile_image_url_https. The table above demonstrates how to apply the same variant selection techniques to SSL-based images.
Why would you want to copy the image to your own webspace? This will increase your bandwidth cost and you get cache consistency issues.
Use the URL that the API gives you.
I can see that you may want to cache the URL that the API returns for some time in order to reduce the amount of API calls.
If you are writing something like an iPhone app, it makes sense to cache the image locally (on the phone), in order to avoid web traffic altogether, but replacing one URL with another URL should not make a difference (assuming that the Twitter image server works reliably).
Why do you want HTTPS?