facebook graph api field image width

How to get source value if its height and width is >= something

MY WORK: i using facebook graph api to get these values.. its output as json object.. that's not the problem i need to get only one link means source value that its width has to given value.

or if its possible to give condition in facebook graph that will be easier

My code:

$url = "https://graph.facebook.com/{$this->post[id]}?fields=images&access_token={$this->user->token}";
$url = file_get_contents($url);
$link = (array)json_decode($url);

suppose think i want to get source value and its height should be > 420...

Array
(
    [images] => Array
        (
            [0] => stdClass Object
                (
                    [height] => 1152
                    [width] => 2048
                    [source] => https://sphotos-b.xx.fbcdn.net/hphotos-snc6/256375_463526207001195_392636722_o.jpg
                )

            [1] => stdClass Object
                (
                    [height] => 540
                    [width] => 960
                    [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/427440_463526207001195_392636722_n.jpg
                )

            [2] => stdClass Object
                (
                    [height] => 405
                    [width] => 720
                    [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s720x720/427440_463526207001195_392636722_n.jpg
                )

            [3] => stdClass Object
                (
                    [height] => 337
                    [width] => 600
                    [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s600x600/427440_463526207001195_392636722_n.jpg
                )

            [4] => stdClass Object
                (
                    [height] => 270
                    [width] => 480
                    [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s480x480/427440_463526207001195_392636722_n.jpg
                )

            [5] => stdClass Object
                (
                    [height] => 180
                    [width] => 320
                    [source] => https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s320x320/427440_463526207001195_392636722_n.jpg
                )

            [6] => stdClass Object
                (
                    [height] => 101
                    [width] => 180
                    [source] => https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/427440_463526207001195_392636722_a.jpg
                )

            [7] => stdClass Object
                (
                    [height] => 73
                    [width] => 130
                    [source] => https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/427440_463526207001195_392636722_s.jpg
                )

            [8] => stdClass Object
                (
                    [height] => 73
                    [width] => 130
                    [source] => https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/s75x225/427440_463526207001195_392636722_s.jpg
                )

        )

    [id] => 463526207001195
    [created_time] => 2012-08-19T16:22:21+0000
)

Answers


You can specify the width and height parameters in the graph api call to retrieve the picture in alternate sizes. eg - https://graph.facebook.com/4/picture?width=300&height=420 Please refer to this blog post for more details - https://developers.facebook.com/blog/post/2012/08/22/platform-updates--operation-developer-love/


Need Your Help

Stringstream write() problem while “overwriting”

c++ stringstream undefined-behavior

Currently, I have a stringstream called Data. I am seeking to the beginning of the stringstream by using:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.