Back to News for Developers

Upcoming Image Cache Changes

January 29, 2008ByJames Wang

In an effort to improve how application images are served on the Facebook Platform, we will be making some changes to the application image cache. These changes should be seamless for the most part: as described in the developer wiki, any images that you currently publish in FBML outside of your canvas page are served using Facebook’s resources, which protects your servers from potentially high load. The src attribute of any img tags are automatically rewritten, so you as developers don’t need to do anything special to get this to work. All of this will continue to work as it does now.

However, one important change in the new design is that we will need to deprecate the method fbml.refreshImgSrc, which currently allows you to make Facebook re-request an image from your servers in the event that the image has changed. After we switch to the new system, if you need an image to be re-requested and cached, you will need to change the URI of your image to something new, which you can do by appending a random variable in the query string, (such as the unix timestamp). We suggest that you use a GET variable called "fbrefresh" to hold the random variable.

For example, if you publish an image to a user's profile with src = "" and that image changes on your server and you want to force that image to be refreshed, then under the new system you should republish the FBML to the profile with the a new img src = "". If you publish the same image to a lot of profiles, and need to periodically update all of those images, then you can achieve this by wrapping that image in a fb:ref tag and updating the image within that fb:ref as necessary.

It’s true that we currently request you not to use these "cachebreakers" to work around problems with the image cache, but with the new backend design for our image cache, this will actually be the recommended method for updating an image. Also, if you need us to remove an application image from the cache for legal reasons, we will provide an email for you to contact, and we will remove the image(s) from the cache after you have removed them from your servers.

These changes will be going out in mid- to late-February. Please don't switch over to the new system immediately, as using cachebreakers is still a problem for the current implementation. But we hope that this gives you ample time to make the necessary changes in your code, and we will publish another post when the changes take effect. We apologize for the inconvenience. If you have any questions or concerns, please contact