2012-09-09 61 views
0

如何获得源值,如果它的高度和宽度是> =东西Facebook的图形API场图像宽度

MY工作:用Facebook图形API来获取这些值..其作为JSON对象输出..这不是我只需要获得一个链接的问题意味着它的宽度必须给定值。

,或者如果它可能给Facebook的图形条件,这将是更容易

我的代码:

$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); 

假设认为我想要得到的输出值和其高度应为> 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 
) 

回答