FB Profile Pic always returned as “.jpg”?

后端 未结 3 478
遥遥无期
遥遥无期 2021-01-21 15:36

Trying to pull user images via the Facebook Social Graph.

Finding it odd that no matter what I upload the image as (gif, bmp, tiff, or jpg), my call to https://graph.fac

相关标签:
3条回答
  • 2021-01-21 16:23

    That's because FaceBook stores it as a jpg, because that is in general the most efficient image format for pictures. It's always a good idea to check if the data is what you expect. Checking image type is quite easy. It will always be a web format, which basically comes down to jpg, png and gif, with gif being very unlikely because of its limitations (GIF can contain 256 colors at most, and is generally larger than png. Has license limitations too). BMP is not a web format and cannot be displayed in most browsers. You will not get a BMP from that url.

    0 讨论(0)
  • 2021-01-21 16:26

    make sure you also handle the case where a gif is returned to you. This is the default profile pic for users that doesn't update their profile pic

    0 讨论(0)
  • 2021-01-21 16:32

    Facebook doesn't save the original image that you upload. Instead it converts all uploaded images to jpgs of 4 different sizes to support all the different places where the image may be displayed.

    In case you are interested, Facebook basically has this down to a science, in fact, I've read several times that they are the largest image hosting service in the world. More details within this Facebook blog post, Facebook Photos Infrastructure

    0 讨论(0)
提交回复
热议问题