2012-04-20 37 views
1

我想在此鏈接中列出的Facebook查詢語言中使用Profile的pic_crop對象https://developers.facebook.com/docs/reference/fql/profile/ 我在我的個人資料圖片上激活了該選項並獲得了以下結果:如何在/ fql/profile/API中使用'pic_crop'

<fql_query_response list="true"> 
    <profile> 
    <pic_crop> 
     <uri>https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/xxxxxx_xxxxxxxx_xxxxxxxxxx_n.jpg</uri> 
     <width>180</width> 
     <height>173</height> 
     <left>0.08468</left> 
     <top>0.06897</top> 
     <right>0.91532</right> 
     <bottom>0.93103</bottom> 
    </pic_crop> 
    </profile> 
</fql_query_response> 

寬度和高度是大圖中正方形的大小。糾正我,如果我錯了,但我明白top leftbottom right是在原始大圖中座標正確定位正方形。我不明確這些是什麼樣的座標。如何使用<left>0.08468</left><top>0.06897</top>的信息我可以到達大圖中左上角的像素來裁剪正方形?順便說一句,我用PHP編寫。

回答

0

左邊,頂部,右邊,底部是比例,而不是絕對位置。

x = width * left = 15.2424 
y = height * top = 11.93181 
sw = width * (right-left) = 149.5152 
sh = height * (bottom -top) = 149.13638 

其中sw,sh是方形的寬度和高度。