Large Image from Event?

So I'm currently trying to retrieve event images from a FB page I created for an organization I'm a part of. When make a call to graph.facebook.com/{event-id}/picture I get an absurdly small 50x50 image. However, the documentation lists a few sizes for the 'type' arg (https://developers.facebook.com/docs/graph-api/reference/event/picture/). When I specify a large type, I get a 200x200px image.

There are the 'height' and 'width' fields, but if I specify anything larger than 200px, such as height: 400 and width: 350, I get a 200x200 pic returned. From previous SO threads it looks like this didn't used to be a problem, so I'm interested in hearing if anybody else has run into this.

Note: I'm using the Koala gem (https://github.com/arsduo/koala) to interact with the API, but direct browser calls are returning the same result.


It turns out there's an API for the cover image. You would think the Event Picture docs would at least mention it .. but it's not the case.

Cover Photo API: https://developers.facebook.com/docs/graph-api/reference/cover-photo/

This worked for me:

String eventCoverImage = "/v2.8/" + eventId;

Bundle params = new Bundle();
params.putBoolean("redirect", false);
params.putString("fields", "cover");
new GraphRequest(
        AccessToken.getCurrentAccessToken(),
        eventCoverImage,
        params,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(final GraphResponse response) {

                // thread is necessary for network call
                Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {

                        try {
                            String picUrlString = (String) response.getJSONObject().getJSONObject("cover").get("source");
                            URL imgValue = new URL(picUrlString);
                            Bitmap eventBitmap = BitmapFactory.decodeStream(imgValue.openConnection().getInputStream());
                        } catch (Exception ex) {
                            ex.printStackTrace();
                        }
                    }
                });
                thread.start();
            }

        }
).executeAsync();

Additionally, this can be of help to try/figure things out with the api https://developers.facebook.com/tools/explorer

链接地址: http://www.djcxy.com/p/32668.html

上一篇: Facebook图形API不能获取所有事件

下一篇: 来自事件的大图像?