I am developing a Facebook game. In that the 10 opponent picture is displayed. I had saved these profile images in the database once the user had registered.
I am using PHP to echo the image, but the problem is some pictures are being displayed and others are giving me a ‘404’ / ‘400’ or ‘Invalid URL ‘ not found error.
Example: ( These images earlier used to be displayed but not anymore)
http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash3/522851_116822898455075_142765921_q.jpg
https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc6/199347_134645999940053_5814468_q.jpg.
How can I fix this problem? Or find some alternative so that the
broken link of these images is not displayed.
I am having the user ID
of these users, Can I somehow generate new picture if these picture links
are detected as broken?
Is it advisable to hotlink the Picture URLs ? I don't want this
problem to occur again?
I would appreciate if some one could help me.
You can use this url to fetch profile images of any user using his/her FB user id's
https://graph.facebook.com/<fb USER ID>/picture?type=large
Related
While going through my friends posts in Facebook Application I have observed that some images with a question like "which characters suits to you in 'some movie name' movie". whenever I click on that image it is redirecting me to their website(Ex:- Brochill) and asking me to login with Facebook credentials.
Once I do login successfully It is redirecting to a page where it is going to show me an image with a character name and image of the selected movie. whenever I click on post on my Facebook wall it is automatically redirecting to my Facebook application and posting that image automatically.
I wanted to know how exactly the internal functionality is working.
My Observations:-
For the website which we are redirecting we need to login first.
without login it will not work.
It will create a same image whenever I tried to click on the image in the Facebook App It is giving me the old generated image. I think they are maintaining the user details with generated images.
Any Ideas?
I know there is a tons of questions about Facebook share... but trust me, I'm trying something different than the normal way of sharing.
Well, I have an Facebook image generate website, but I don't wanna to generate images every time an user enter. So its create an canvas, and then a "og:image" url with an ID..
Then when someone hit the share button, it open the Facebook UI, and:
-Facebook goes into the url with an ID.
-the php script check if the image is already created.
-if not, create the image and save it on amazon S3.
-an finally redirect to the S3 url.
The problem is, if I hit the share btn and post right after it has open... Facebook take an random image of the page.. its like he can't wait the processing and just give up o.o
Someone please know how to prevent it to happen?
I'm stuck with this problem for several weeks now and will try to give a short and detailed explanation below:
Situation
Users visiting the websites and has the option to generate an image with the GD-library. So every users generated a personal image. Simple... until now. After generating the image, the user gets the option to share this image to Facebook. This is done via the OpenGraph protocol.
What's working (Yeah!)
Generating the image is working perfectly fine. Sharing something to Facebook is working also.
Problem
Although the following code is used on sharing the image (fbrefresh=CAN_BE_ANYTHING). FB stills pulls an old image. Sometimes this is a really old image, sometimes it's a more current generated image. But never the just generated image.
And now?
As said I've already tried the fbrefresh=CAN_BE_ANYTHING. Also in de debug tool the right image isn't showing up, but this is probably because the generated image has an unique ID generated from the users cookie. So this id is only usable when the users clicks on generate and after that shares the generated image.
Is there any example on the internet that uses the same sort of strategy and is working? I've searched half the internet and didn't found it yet it's becoming more and more frustrating.
After generating the image, the user gets the option to share this image to Facebook. This is done via the OpenGraph protocol.
What exactly do you mean by the latter? Are you just uploading that image to the user’s wall/one of their albums, or are you publishing an Open Graph object with a user-generated photo attached? (Btw., user-generated photo is meant literally for OG actions – you should only do it with photos that the user has taken using f.e. their mobile phone camera while they where undertaking the action. I doubt if a GDlib-generated image fits into that description.)
Although the following code is used on sharing the image (fbrefresh=CAN_BE_ANYTHING). FB stills pulls an old image.
And by “pull” you mean what exactly, again? Do you upload the photo as an HTTP POST upload, do you upload it by URL, did you specify it as og:image for an OG object, or do you pass it as user-generated photo while publishing an action?
Now, usually the easiest way for resources referenced by a URL to get properly refreshed by the requesting client, is to attach a different value to the query string/as a GET parameter – f.e. the current unix timestamp: …/image.php?1984372634 or …/image.php?foo=bar&forcerefresh=1984372634
Since this value changes every second, it makes each of those URLs a different URL, and the requesting client absolutely has no choice but to request that resource, because he can not have it in its cache already.
So what I am trying to do is post an image that has been created by a user on an iphone into that users newsfeed.
The functionality I am having a hard time understanding if it is possible:
Can I pass a local NSURL (or URL?)(to a png file that lives in the documents folder) through a JSON string and onto Facebook?
i want to mimic the action of a user going to his/her facebook page, clicking into the textfield for their newsfeeld, uploading an image by clicking the "photos" icon and selecting an image from a local disk and uploading it. I would also like to add some text into the post optionally.
I'm just getting started with the Facebook api and it seems pretty tough right now, any help would be appreciated. code examples appreciated.
Thanks,
Nick
You'll need to use a third-party image host like YFrog or roll your own image host. Facebook requires that all media attachments (including photos) be hosted on the public web. Even though they cache the images themselves, the URL that you send to them has to have its own public URL. Many of the popular Twitter image hosts have simple REST APIs to achieve this.
You can also use Facebook itself to host the image via their photo.upload API, if you don't mind two side-effects: it will appear in the user's photo albums, and the thumbnail is likely to appear in the stream twice (once representing the addition to the photo album, and the second in the actual stream story you publish). You can't currently get around this doubling artifact, but it will give you a stable host for the uploaded image.
Just to clarify this. I was actually able to pass and image directly from the iPhone without a third party but that was posting an image to a users photo album. There are I think two methods in the fbconnect api for posting one contains an extra argument for a data argument which can be an image. I'll post more details when I'm in front of the documentation.
Is there any way to upload an image (UIImage) directly from an iPhone app to a user's wall/feed?
All the samples I see are either using a json-embedded link or they use the photos.upload call with album ID (aid) which results in the user getting the image in his photo album(s).
What I want to do is to upload an (UI)Image created (by the user) inside an iPhone app and upload to his/her wall. Is this possible? Sample code would be highly appreciated.
This isn't possible. To understand why, you have to consider the conceptual model that Facebook currently uses: Posts on a user's wall are just bits of text optionally attached to some link URL. That link URL can be some random image on the web, or it can just as well be an image that the user already has in their photo albums.
But a wall post cannot inherently "contain" an image in and of itself. Therefore you need to host the image somewhere, be it on your own site, or on Facebook itself, inside one of the user's albums by uploading it first to there.
I'm trying to figure out the same thing myself. One thing I did find out is that if you post the "Wall Photos" album they do get posted to the wall. However you only have a wall photos album if you've uploaded photos to your wall from your profile page before. And even then, you need to get the album aid and then post to it.
EDIT
Found a much better solution. First upload the photo to your default album, then make a post to the wall with the link to your photo that was returned when uploading (not a link to the image but the page the image is on).