How to get a larger scraped feed picture? - facebook

I read the documentation, and the scraped feed picture is stored inside the picture tag.
Unfortunately, it returns a small version of the picture. I need a larger one.
How can I do it this Graph API? Seems that API/workarounds have been changed.
No way anymore? Can't find anything in the Facebook documentation.

This should work:
/post-id?fields=picture.type(large)
/post-id?fields=picture.width(100).height(100)
Source: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2?locale=en_US#fieldexpansion
Edit: Actually, it does not seem to work for the user feed, but there is an "object_id" in the result of /me/feed. You can do another request to that object_id:
/object-id
...resulting in all the available images sizes:
"images": [
{
"height": 526,
"source": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t1.0-9/10444402_888067974538310_2165197996181662459_n.jpg?oh=4518cc6608a14a2108aeaf61bcb60d09&oe=5501E78D&__gda__=1426703335_d71feeeb9aa6d8fd58085cd6074101e3",
"width": 526
},
{
"height": 480,
"source": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t1.0-9/p480x480/10444402_888067974538310_2165197996181662459_n.jpg?oh=bc0736fc9f74b1a4d89727ae5526dd3b&oe=5517CD73&__gda__=1427230414_1197a9870346dbaaf300c2ea0e359402",
"width": 480
},
...

New way - /{post_id}?fields=full_picture

Related

Svg in Mirador 3 viewer

I'm using Mirador viewer with annotation file that include 'xywh' values to set rectangels on the image.
I want to use Svg instea, so i can draw polygons on the image.
I found here: IIIF Api the annotation item struct to include svg, but it's not working for me.
Can anybody help please?
Thanks
Can you provide an example of the SvgAnnotation that you are trying to use?
Mirador 3 should support this style of SvgAnnotation:
"motivation": "commenting",
"target": {
"id": "https://iiif.bodleian.ox.ac.uk/iiif/canvas/9cca8fdd-4a61-4429-8ac1-f648764b4d6d.json",
"selector": {
"type": "SvgSelector",
"value": "<path xmlns=\"http://www.w3.org/2000/svg\" d=\"M3548.40946,1221.66399c0,-84.79382 68.73897,-153.53279 153.53279,-153.53279c84.79382,0 153.53279,68.73897 153.53279,153.53279c0,84.79382 -68.73897,153.53279 -153.53279,153.53279c-84.79382,0 -153.53279,-68.73897 -153.53279,-153.53279z\" fill=\"none\" fill-rule=\"nonzero\" stroke=\"#00bfff\" stroke-width=\"1\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-miterlimit=\"10\" stroke-dasharray=\"\" stroke-dashoffset=\"0\" font-family=\"none\" font-weight=\"none\" font-size=\"none\" text-anchor=\"none\" style=\"mix-blend-mode: normal\"/>"
}
},
"type": "Annotation"
},
https://github.com/ProjectMirador/mirador/blob/5ca33205bf9bac636ba5ef0faf820f58c0d9751d/__tests__/fixtures/version-3/001.json#L301-L310

How to make soundcloud oembed endpoint return an iframe with a height of 300?

I am using souncloud's oembed endpoint, and the default height is 400, which is too big.
I need to adjust it, i have tried this:
https://soundcloud.com/oembed?format=json&height=300&url=https://soundcloud.com/giorgiomartini
But that only changes the height of the artwork, notice height at the end of the html key (the iframe), on the json i get back:
{
"version": 1,
"type": "rich",
"provider_name": "SoundCloud",
"provider_url": "http://soundcloud.com",
"height": 450,
"width": "100%",
"title": "Giorgio Martini",
"description": null,
"thumbnail_url": "http://i1.sndcdn.com/avatars-000336450748-qnkjy0-t500x500.jpg",
"html": "<iframe width=\"100%\" height=\"450\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?visual=true&url=https%3A%2F%2Fapi.soundcloud.com%2Fusers%2F1367858&show_artwork=true&height=300\"></iframe>",
"author_name": "Giorgio Martini",
"author_url": "https://soundcloud.com/giorgiomartini"
}
I do need however to change the height of the iframe itself... is there a waywith oembeed to do this?
Or do i have to do some kind of string manipulation on the response i get back to change the height from 400 to say 300?
Thanks
According to the documentation, there is an URL parameter called maxheight - simply set this to 300:
https://soundcloud.com/oembed?format=json&maxheight=300&url=https://soundcloud.com/giorgiomartini
I would recommend using CSS instead to make the video iframe responsive, so it always fills up its parent container no matter the size of the window, on any device. See Fluid Width Video and the VideoWrapper class.

I could not find json file in OSMBuilding

I make clickable buildings with OSM Buildings. When I click a building, I get Building ID. However, I could not get height of a building because I cannot fing JSON file to get this value.
Codes are here:
var map = new L.Map('map');
map.setView([52.52111, 13.40988], 16, false);
new L.TileLayer('https://{s}.tiles.mapbox.com ...
https://codepen.io/osmbuildings/pen/JdaaRM
To sum up, I want to get height of a building with using OSM Building.
The height is contained in the JSON file.
See this example here: https://b.data.osmbuildings.org/0.2/anonymous/tile/16/35210/21491.json. It contains a properties field which in turn contains height and levels:
"id": "w24273225",
"type": "Feature",
"properties": {
"height": 65,
"levels": 17
},
"geometry": {
"type": "Polygon",
"coordinates": [
[...]
]
}
The height and level information is only present if the building in OSM actually has this information. This isn't the case for every building.

Facebook Like - displaying the correct image and content

I have a website (not a FB app) that has a page of which I have added a "Like" button to, using the facebook like button generator.
I am having trouble specifying the exact image I want to share along with a specific content.
I have tried the Open Graph meta tags, but these seem to be ignored (possibly they are only for FB apps??)
I'm using the following code for the button:
<div class="fb-like" data-href="https://www.MYURL" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
The functionality itself is working. It will share the link onto FB but not using the content/image I would prefer.
What am I doing wrong?
Debug
{
"og_object": {
"type": "website",
"updated_time": "2014-09-05T09:58:07+0000",
"url": "https://www.MYURL",
"id": "MYNUMBER"
},
"share": {
"comment_count": 0,
"share_count": 0
},
"id": "https://www.MYURL"
}

Facebook Graph API - How do you retrieve the different size photos from an album?

Ok, first off let me tell you I have no problems getting a user's photo album(s) and looping through the output to display all of the photos in the size I want.
However, if I want to call a photo like:
<img src="https://graph.facebook.com/<?=$this->session->page->photo_id?>/picture?access_token=<?=$this->session->member->facebook_access_token?>" />
I cannot figure out how to tell it the size I want it to show.
In this sample code from Facebook you will see that whey retrieving the album each photo in the array comes back with the different sizes in this sample array. I could just save the thumbnail url from this, but I don't want to store it, just retrieve when needed.
{
"id": "10150146071831729",
"from": {
"name": "Facebook",
"category": "Product/service",
"id": "20531316728"
},
"picture": "http://photos-g.ak.fbcdn.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_s.jpg",
"source": "http://a7.sphotos.ak.fbcdn.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_n.jpg",
"height": 483,
"width": 720,
"images": [
{
"height": 483,
"width": 720,
"source": "http://a7.sphotos.ak.fbcdn.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_n.jpg"
},
{
"height": 120,
"width": 180,
"source": "http://photos-g.ak.fbcdn.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_a.jpg"
},
{
"height": 87,
"width": 130,
"source": "http://photos-g.ak.fbcdn.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_s.jpg"
},
{
"height": 50,
"width": 75,
"source": "http://photos-g.ak.fbcdn.net/hphotos-ak-ash1/168119_10150146071831729_20531316728_7844072_5116892_t.jpg"
}
],
....... continued...
}
There has to be a way to retrieve these different sizes.
Thanks.
Facebook provides a type option for the picture field, for example, you can specify something like:
<img src="https://graph.facebook.com/xxx/picture?access_token=yyy&type=normal />
where the type parameter can be one of square, small, normal, or large for profile pictures or thumbnail, normal, album for album pictures.
Source: http://developers.facebook.com/docs/reference/api/user/ (under Connections section)
Edit: Added different options for album pictures
Thought I'd share a little trick in getting larger image sizes from the Graph API. Facebook as a little convention with image URLs that's not very obvious. For instance, take the following URL:
https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-prn2/t1/1185356_10201176263222205_1153673992_s.jpg
Notice the _s.jpg at the end? That determines the size of the image. You can change this to _o.jpg to get the "original" full size version. In other words, update the image URL to:
https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-prn2/t1/1185356_10201176263222205_1153673992_o.jpg
Every Facebook image has an _o.jpg version. Worst case, you get something the same size as the thumbnail. If that's the case, you're no better off than you were before.
here src_big and src are different size image url source
function get_photos_by_album_id($album_id){
if($album_id)
$fql = 'SELECT pid,src_big,owner,link,position,created,caption,src FROM photo WHERE aid="'.$album_id.'" ORDER BY created DESC LIMIT 0,6';
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $this->facebook->api($param);
return $fqlResult;
}