Comment a facebook post with an image/picture via API - facebook

I would like to be able to reply/comment a facebook post with an image using API.
If I'm able to achieve that with python it would be fantastic, but also other languages would be ok.
Using an image url or a local stored image makes no difference.
Another option that would fit for me is to use a GIF.
I noticed that if I insert a giphy.com GIF link, the GIF is showed correctly, but the URL is visible and I would like to make it invisible.
Any solution to achieve any of the two?
Thanks

Related

Is it possible to use an uploaded file handle to upload to Facebook from the share dialog?

I have a photo sharing web application and one of my requirements is to add a way to quickly share a photo to Facebook.
I have looked at several ways to do this, and the one I like the most is to get an OAuth access token and redirect back to my site. Once they select the image they want to share, I then launch the share dialog window in an iframe:
https://www.facebook.com/dialog/share?app_id=[MY_APP_ID]&display=iframe&href=https%3A%2F%2Fexample.com%2Fsomepic.jpg&access_token=[TOKEN_FROM_OAUTH]
This all works fine, except it shares a LINK to the picture and doesn't actually upload the image and store on Facebook.
So, my next thought was to use my access_token and create an upload session. So, I first create the session at this endpoint:
POST https://graph.facebook.com/app/uploads?access_token=[MY_OAUTH_ACCESS_TOKEN]&file_type=image/jpeg
That returns a session id for me as I expect. I then upload the file through this endpoint:
POST https://graph.facebook.com/[SESSION_ID_FROM_PREVIOUS_STEP]?is_reusable=true&file_length=[BYTES_OF_IMAGE]&data=[IMAGE_DATA_BYTES]
The above all seems to work, and it returns me a "File Handle". Something that looks like this:
4::aW1hZ2UvanBlZw==:ARaQWknagoLiMi1rE4wzsPLLKoWuwj0hpx8Wyv9p7VX0cMvZ0c5qTESqW1qyeb-ejM-BsoIaHcy1DfkEGZhAAaN-7ShSffoRDEZn1kK1IJ00bA:e:1632539894:100624633370919:533575686:ARZVnrjRFvfvQcEYvbw
Now to the point of my question. Is it at all possible to somehow pass the above file handle to the dialog share iframe as opposed to passing it a URL? Something like this:
https://www.facebook.com/dialog/share?app_id=[MY_APP_ID]&display=iframe&attachment_id=4::aW1hZ2UvanBlZw==:ARaQWknagoLiMi1rE4wzsPLLKoWuwj0hpx8Wyv9p7VX0cMvZ0c5qTESqW1qyeb-ejM-BsoIaHcy1DfkEGZhAAaN-7ShSffoRDEZn1kK1IJ00bA:e:1632539894:100624633370919:533575686:ARZVnrjRFvfvQcEYvbw&access_token=[TOKEN_FROM_OAUTH]
I know that attachment_id doesn't work, but is there another way to do this?
It may not be possible, but would make it a cleaner solution that having a link to the images, which may end up changing...
Thanks!
My thoughts so far:
To Post a image with text to a Facebook Page i use this endpoint 'https://graph.facebook.com/{page-id}/photos?url={image-url}&message=your message'
This works fine but to get the {image-url} the image needs to be uploaded beforehand.

Unity facebook SDK, can not post picture with FB.Feed

In my Unity IOS game, I am unsuccessfully trying to use FB.Feed to share a screenshot on the user's wall.
Facebook documentation uses FB.Api to publish the screenshot, but this method does not display a share dialog, it simply uploads the pic to Facebook.
Answers I have found so far:
Upload the picture using FB.Api, and then parse the FBResult for the picture URL, and feed that to FB.Feed Link to answer.
This method triggers an error, since it is not possible to use a Facebook URL as source for a picture.
Save the picture locally and prepend "File://" to the picture path. Link to question. This does not seem to work either, and the Facebook documentation does not seem to have any information on URL formatting.
My question:
Is this the correct (and only) way to display a share dialog when publishing a picture? Or am I looking in the wrong direction?
FB.Feed only allows you to post link to images. It doesn't upload the images to Facebook. Therefore, these images need to hosted somewhere on the net and not locally.
The best way to make it work is either upload the images to FB (with privacy property set to EVERYONE) using FB.API, and then share the link to that picture via FB.Feed. If you don't want to create duplicate stories, i.e. one from posting the picture and another from FB.Feed, make sure that you set no_story to true.

how to share animated gif on facebook

i'm going to create facebook app using javascript sdk.i want to create app which shroud be able to post animated gif .my idea arise after see this app and https://www.facebook.com/khalil.shr/app_212097992149339. it work 100 percent .
and another best example is https://www.facebook.com/photo.php?fbid=471334666225107&set=p.471334666225107&type=1 take a look this picture animated without clicking on it.i can't guess how it work ..i want a complete guide about that ..
There is no API which allows animated GIFs to be uploaded to Facebook - any you see on Facebook were uploaded while there was a bug in the image validation code and are only visible because the images were not retroactively removed
You can't upload an animated GIF to Facebook. There are however some ways to outsmart the system. For example, the 3 ways mentioned in Guide to Animated Gifs for Facebook. It says:
If you try to upload a GIF to Facebook, a still image of the first
frame will appear. However, there are three ways to try and outsmart
the system.
Make a Youtube video look like a GIF.
Use a third party app on Facebook like Animated Picture. For this app, you do not use your own files. There are hundreds
sorted out in different categories to choose from.
Post a link to the GIF. Yes, the still image will show up, but a description will accompany it. Yes, it may take more time, but
your friends will be curious as to what it entails.
But, if the GIF you want to upload is not a moving picture, it should
work just fine. If you have a GIF image that is a nonmoving image, you
should have no problem uploading it to Facebook. According to the
Facebook Developers page, GIFs are one of many file types allowed for
uploading to the platform. Other supported image file types include
JPG, PNG, PSD, TIFF, JP2, IFF, WBMP and XBM images.
Similarly, you can find many other workarounds to this on the internet.
there was a bug back in 2012 which allowed user to upload an animated .gif by renaming it to .jpg and then upload it as an image. This has been fixed , although you can still see the gifs that were uploaded before the fix.
NB: check uploaded date of all animated images in facebook, all of them are uploaded on or before year 2012
Looks like Facebook finally enabled the GIF support!
You can upload gif image to some 3rd party website (Gipfy or something else) and then upload this link to facebook - then it'll be displayed as animated GIF!
http://techcrunch.com/2015/05/29/facebook-confirms-it-will-officially-support-gifs/#.pfn8nn:CJC4
It is possible to publish a GIF through the Graph API, please see an example call below:
curl \
-X POST \
"https://graph-video.facebook.com/v2.8/{page-id}/videos" \
-F "access_token=<sanitized>" \
-F "source=fluffy_cat.gif" \
You can now post an animated Gif on facebook by posting it as a video. If you post it as a photo it will not be animate-able and will display the first frame only.
To post an animated gif from URL use this Graph API call:
POST /me/videos
access_token=<access token with "publish_actions" permission>
file_url=<url to file>
Alternatively you can replace me with another user or page identifier.
The best way to share an animated gif on Facebook, is to
Upload the GIF to an image hosting site that allows animated gifs, such as http://imgur.com or http://photobucket.com then
Get the direct URL to the image from that site
Post the URL to the GIF on Facebook
Remove the image preview, as that will be a still image, and people won't realise its an animated gif if they see a still image preview. Add text to the image's description that it is an animated GIF, and that they need to click the link to see the animation.
Pro Tip: If you want to be able to view animated GIFs directly on Facebook, without having to click the GIF links as mentioned in the method above. You can use a browser extension such as FB Purity : http://fbpurity.com as it has an option called "View Animated Gifs". When this option is turned on, whenever the extension sees a link to an animated GIF on the Facebook site, it automatically converts it to a fully working and moving Animated GIF, so you don't even need to click the link to see the animation.
Another method is to convert the animated Gif into a video file then upload that, as Facebook now autoplays Video files, just like animated gifs. One way to convert an animated GIF to a video file is to use the free, open source Virtual Dub software. Get Virtual Dub here http://www.virtualdub.org
Open your .gif as a video file in Virtual Dub... then save as .avi then upload the new file to Facebook.
Though you can search google for other methods of converting animated gifs to video files if you dont want to use Virtual Dub.
There are also some other alternative methods listed here:
https://superuser.com/questions/5730/how-do-i-convert-an-animated-gif-to-a-youtube-friendly-video-format
If you want to do it from your own site you must have verified (green lock icon)secure layer socket SSL installed certificates. Then just go to Facebook debug and add the link. EASY!

Facebook Unity Upload Image w/ Facebook Dialog

We currently allow users to post images to their FB wall by using FB.Feed() with a URL of existing images on our CDN and we can include a description, a link, caption, etc.. The interface for posting the image is great because it's built by Facebook and gives the ability to choose who sees it (friends, me only, etc.).
We now want to allow users the ability to post images of their creations in the game, which obviously can't be pre-taken images on our CDN, and we'd prefer avoiding the route of uploading all the images to our CDN then using FB.Feed().
I know it's possibly to upload an image using FB.API() but this requires us building a custom popup to allow the users to type what they want to say for the message of the image rather than using the built-in popup from FB.Feed() and it doesn't give the options of who sees the post and as far as I can tell, it doesn't let us add a link, description and caption.
TLDR: Is FB.API() the only way to UPLOAD an image to a user's wall? If so, this requires building a custom interface for it instead of using the built-in FB.Post() interface, right?
Thanks,
Colter
Edit: I didn't see this post until now, but it's a similar question but I want to know if there is the ability to add a description, link and caption to the image AND use the built-in FB interface.
Copy/paste from Brian Jew's comment above:
"There currently isn't a way to upload screenshots without FB.API(). It does sound like an interesting idea to have something like that for FB.Feed() though."

Like - Sharer.php ignoring image despite og meta

Despite the meta tags (the first one I never used before, but it came up in the addthis forums);
And the debug tool getting the data in a correct manner:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.mondiales.nl%2F
The facebook sharer code does not use the image specified. No images show up at all, there is no thumbnail chooser.
Looking at the HTML of the facebook sharer page, the image is actually there! The thumbnail chooser has a display:none. And when posting the damn thing, no image shows up on the wall.
Stop using addthis and implement a like function using the just the Facebook API? But from what I read, Facebook does a request for the page to get it's data so the JS part should not be the issue, should it?
Did I overlook something?
There's a restriction on the width/height ratio of images shared, the ratio must be less than 3.0
Your image is too wide (211/66 = 3.19) - add some vertical whitespace and it'll share OK i think
For future reference this is mentioned on both the old Share Button docs and the Open Graph protocol docs (under 'og:image')
I've found that once I've posted something to my wall from the sharer or the app, if I try to repost it, it will remember the original image (or no image in your case).
It might be worth clearing the whole cache/cookies from your browser and see if that does the trick.
If not, you'll find that if you log in as another user of Facebook and they try to post it, it will pick up on the new image on their account and not yours.
I'm not exactly sure how Facebook caches the images.
I know this thread is old but this may help someone else with the same issue. FB caches shared urls along with the thumb images and descriptions. To update the cache, add a bogus parameter to your shared query string, like, "?v=1". This gets the latest og tags.