Read multiple images from a post Facebook with the Graph feed - php

Through a lack of good documentation of the Facebook Graph I need your help.
I use this piece of php code to get posts form a Facebook page:
file_get_contents_curl("https://graph.facebook.com/v2.6/$pageFBID/feed?fields=full_picture,message,story,created_time,shares,likes.limit(1).summary(true),comments.limit(1).summary(true)&access_token=".$token);
This call works fine but I want to get all the images, instead of only one. Does someone know how?

I finnaly found the soluction. You have to add the 'parameter' attachments to the url to get all the images and other media attached to the post, in a large size.
file_get_contents_curl("https://graph.facebook.com/v2.6/$pageFBID/feed?fields=full_picture,attachments,message,story,created_time,shares,likes.limit(1).summary(true),comments.limit(1).summary(true)&access_token=".$token);

Related

facebook api php post images to timeline [duplicate]

I could set custom picture and caption for link. Now it is impossible for v2.9. Is there some kind of workaround without specifying og: tags.
When using Facebook Graph v2.8, you could post a link and display a custom image and not the "og:image".
This was done by adding the picture parameter to the hook.
https://graph.facebook.com/v2.9/me/feed?link=https%3A%2F%2Fwww.google.com%2F&picture=https%3A%2F%2Fi.ytimg.com%2Fvi%2FtntOCGkgt98%2Fmaxresdefault.jpg&name=test&message=this%20is%20a%20test&access_token=**********
The graph API is at 2.9 and as per the documentations this is still supposed to work Facebook API doc
However, it keeps getting overridden by the scraped image. Is anyone else experiencing this problem or have a workaround.? Facebook API Explorer
picture, name, caption, thumbnail, description are all set to be deprecated.
https://developers.facebook.com/docs/apps/changelog#v2_9_90_day_deprecations
You can go ahead and use Open Graph for posting images with custom description and title.
You can get an insight of the same from this link -> https://developers.facebook.com/docs/sharing/webmasters?hc_location=ufi

How can I publish an image from url with Twitter API?

I'm trying to publish an image from URL with Twitter API and PHP but I can't do it.
I have seeked in many post but I could find only how to upload an image.
Is possible to do it?
As you have discovered, this is not possible.
One way around it is for you to download the image first, and then upload it.
For example
file_put_contents("temp-img.jpg", file_get_contents("http://example.com/flower.jpg"));
Then, using whichever Twitter library you have, you can post temp-img.jpgdirectly.

How to embed twitter tweets .. How to catch images from tweets URLs and display the actual images?

I was wondering what kind of method I could use to directly embed videos or pictures contained in twitter tweets directly ... For example .. below is a tweet from OBAMA
President Obama: "Right now, we have a real chance to reduce gun violence in America." http://t.co/tmCoUsPyyB #TimeToAct
The link that starts with htttp:// could be a picture .. How can I actually program it so that tweets are directly displayed with the images from the urls ? I know PHP and I used the twitter API before , but I dont know how I could easily achieve that . Any help would be appreciated
The first step would to to pull the URLs of of the block of text, there is another question that points you how to solve this: Extract URLs from text in PHP
You can then use Embedly or a service like it to pull the metadata associated with that url. Here is an example of the meta data that Embedly will return: http://embed.ly/docs/explore/oembed?url=http%3A%2F%2Ft.co%2FtmCoUsPyyB
The html attribute is what you want to render on your page.
We also have a PHP library you can use as well.
Hope that helps!

Post a link on Facebook wall og:image does not works

i just want to copy and paste my website links on users facebook walls , when share from http://www.tvguide.dk/nyheder/2011-10-15/TV2_satser:_Nu_med_spritnye_v%C3%A6rter_!/ share buttons it works and picks a correct og:image thumbnail ,
however when i copy paste the link on the wall the facebook picks the logo image. insted of og:image value
can you guys help me please
You won't be able to change that, unless you always upload a picture when you post on someones wall! The og:image is only used for the open graph which is used from like and share buttons, comments etc, but not in facebook itself.
Read up on internationalization: http://developers.facebook.com/docs/internationalization/
Your website is in Danish but you have used set locale as en_US. Also the title, type and URL properties are not being interpreted correctly by Facebook. http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.tvguide.dk%2Fnyheder%2F2011-10-15%2FTV2_satser%3A_Nu_med_spritnye_v%25C3%25A6rter_%21%2F
Make changes and check the progress at URL Debugger(Linter) given above. If everything fails try including the FBJS SDK and use fb:share-button. I had a similar problem once with WordPress which got solved using the JS SDK

Flickr API PHP getPhotoSets Description

I'm trying to integrate the Flickr API with Jquery Gallerific. If you're familiar with Gallerific you know photos in the Gallery can have a caption. I'm trying to pull photos from a specific set from a user using flickr.photosets.getPhotos to get thumbnails. However, with this method it's not possible to get description for each thumbnail, only for the set so I'm having to run flickr.photos.getInfo for each photo in the set, which works but is pretty much useless as a page takes 10+ seconds to load. Does anyone know how to obtain flickr photos from a set with the individual description for each photo? I've looked through the API but can't seem to find anything.
Thanks in advance!
Never actually used the Flickr API but what about just loading the thumbnails initially, then using JSONP (or a custom "proxy" of sorts) to query photo information asynchronously after the page has loaded. Or, better yet, when the user actually hovers over an image.

Categories