照片尺寸可通过 Graph API / FQL 获取并显示在自定义查看器中
我在 FB 画布应用程序中为 Facebook 照片创建一个照片查看器。因此我关心照片尺寸。 FB 里上传的照片似乎都有不同的尺寸。我在图形 API (http://developers.facebook.com/docs/reference/api/photo/) 中看到源属性中的术语:“最大宽度或高度为 720px”,还有宽度和高度属性。我在 fql photo (http://developers.facebook.com/docs/reference/fql/photo/) 中有几个照片尺寸。
- 某一类别(src_small、normal、src_big)中可用的照片尺寸是否始终相同还是可以不同?我想他们可能有所不同。
- FB 支持哪些格式?我认为它是小正常和大
- 如何从概念上处理查看器中的不同尺寸?我想你需要修复查看器区域,例如。 3(高度):4(宽度)。现在通过最大化高度或宽度来调整查看器内图像的大小。
我正朝着正确的方向前进吗?
I create a photo viewer for fb photos in a FB canvas application. Therefore I care about photo size. It seems all uploaded photos in FB seem to be available in different sizes. I see in the graph API (http://developers.facebook.com/docs/reference/api/photo/) the term in the source property: "maximum width or height of 720px" but as well a width and height property. As well I have several photo sizes in fql photo (http://developers.facebook.com/docs/reference/fql/photo/).
- Are the photo sizes available in one category (src_small, normal, src_big) always the same or can they differ? I suppose they can differ.
- What are the formats FB supports? I suppose it is small normal and big
- How to conceptually deal with different sizes in a viewer? I suppose you need to fix the viewer area, eg. 3 (height) : 4(width). Now size an image inside the viewer by maximizing the height or width.
Am I heading to the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您是否注意到,Graph API 中还有一个“图像”字段,其中包含与 FQL 类似的“照片的 4 种不同存储表示形式”。
从第一个视图来看,存储的图像似乎每个表示都有固定的宽度。
大尺寸为 180 像素,中尺寸为 130 像素,小尺寸为 75 像素。还有一个原始图像,其最大宽度为 720 像素。
FB 仅支持 JPEG 格式。
从概念上讲,您应该有一个固定宽度的窗口来显示您想要显示的图像大小(假设您使用宽度为 180px 的图像向用户显示最大的 [large] 图像。那么高度 <= 180px。所以您可以使一个 180x180 的盒子,如果图像高度较小,则将背景填充为黑色,
或者像 facebook 那样,将原始图像设置为尽可能大的大小。弹出窗口,以便他们可以使用最大量的图像空间。
使用有效的 CSS,可以轻松处理不同尺寸的图像。
所以,是的,您正朝着正确的方向前进,只需分析 Facebook API 并充分利用它们即可。
如果您在编写所需的 CSS 或组合 FQL 查询时遇到任何问题,请随时提出另一个问题:)
关于 CSS 图像调整大小的阅读很少
Not sure if you noticed, but there's also an "images" field in the Graph API which holds "The 4 different stored representations of the photo" similiar to the FQL.
From the first view it seems that the images stored have a fixed width per representation.
180px for the large, 130px for the medium and 75px for the small size. Also there's a original image which is has a maximum width of 720px.
FB only supports JPEG format.
Conceptually you should have a fixed width window for the image size you want to show (let's take that you show the biggest [large] image to the user using the one with width 180px. Height is then <= 180px. So you can make a 180x180 box and fill the background in black if the image height's is smaller.
OR do it like facebook does. Take the original image and fit is as big as you could into the window. They use a pop-up so they could use up maximum amount of space for the image.
Using valid CSS it'll be easy to play with images different sizes.
So yes, you're heading to the right direction, just analyze Facebook API's and take the most out of them.
If you have any trouble writing the CSS needed or putting together the FQL query, feel free to ask another question :)
Little reading about CSS image resize